Thanks for your reply. I'm trying to display the contents of a PHP file in a div (#results) without submitting a form. The above code uses a form submission.
Thanks for your reply. I'm trying to display the contents of a PHP file in a div (#results) without submitting a form. The above code uses a form submission.
how do you want to trigger it? on page load? on a click event? on a timer? also without the form your not submitting any query. if you just want to load a simple php file then:
Code:
$('#php_results').load("somefile.php");
//or on document ready when the dom loads it will happen
$(document).ready(function(){
$('#php_results').load("somefile.php");
});
nope. though you hook in on the form’s submit event, you cancel the form submission on the last line.
and if it were indeed submitting the form, the AJAX call would be pointless because when the response comes back, the handling JS code is gone due to the (re)load.
__________________
please post your code wrapped in [CODE] [/CODE] tags
perhaps this then. also if data.php needs some information posted to it to return a result, this is not good enough becuase you are nto capturing and sending any data to data.php
Code:
$(document).ready(function(){
$(".refresh").live("click", function () {
$('#results').load("data.php");
});
});