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
?
The jQuery load() method is a simple, but powerful AJAX method. The load() method loads data from a server and puts the returned data into the selected element.
Yes, it's possible, but you'll need 1 line of PHP :) If you only need RSS feeds and you don't mind relying on Google you could use jquery-feeds.
Use $.param(data)
:
$("#output").load( "server_output.html?" + $.param({ year: 2009, country: "Canada"}) );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With