If you are looking for an AJAX solution, you can use this function. It can send variables through the URL and receive a response from the source url.
function get_(url, func)
{
var http;
try { http = new XMLHttpRequest(); } catch (e) { try { http = new ActiveXObject(\"Msxml2.XMLHTTP\"); } catch (e) { try { http = new ActiveXObject(\"Microsoft.XMLHTTP\"); } catch (e) { alert(\"Your browser broke!\"); return false; } } }
http.open(\"GET\", url, true);
http.onreadystatechange = function() { if(http.readyState == 4) { func(http); } }
http.send(null);
}
To use this, here is an example of how a button triggers the call and specified a response handler function:
HTML
<button onClick='get_("source_url.jsp", showResponse);'> Show the response </button>
JAVASCRIPT
function showResponse(h) { alert(h.responseText); }
To be clear, the second parameter of the get_ function is a reference to a function. Whatever function you specify when using the get_ function, it passes a single parameter which containes the .responseText property, which is the output from the source_url file.
I use this function all the time, though I have another version that works with my PHP server to authenticate the user so that there is no unauthorized loading/saving of information from/to the server.