I'm reading the jQuery load documentation and it mentions that I can use load to perform a GET request by passing in extra parameters as a string. My current code with my parameters as key/value pair is:
$("#output").load(
"server_output.html",
{
year: 2009,
country: "Canada"
}
);
The above works fine but it's a post request. How can I modify the above to perform a GET request while still using load
?
Use $.param(data)
:
$("#output").load(
"server_output.html?" + $.param({
year: 2009,
country: "Canada"})
);