req.responseText.js

var url = '/data.php'; var params = [ 'id=934875', 'limit=20' ]; var req = new XMLHttpRequest(); req.onreadystatechange = function() { if (req.readyState === 4) { var responseHeaders = req.getAllResponseHeaders(); // Get the response headers. var data = req.responseText; // Get the data. // Process the data here... } } req.open('GET', url + '?' + params.join('&'), true); req.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); // Set a request header. req.send(null); // Send the request.
By far the most common technique used, XMLHttpRequest (XHR) allows you to asyn- chronously send and receive data.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.