I consider myself a competent coder but for the life of me cannot get Ajax to consistently work on a website i'm developing on localhost.
What's annoying is it works in IE7 but not FF......
I've tried writing the code myself to no avail, now I've tried using jquery's built in ajax support and still it doesn't work. Can it get more simple than:
In Firefox the first time this runs it works and insert.php runs its SQL, however it will not work again, even after page refreshes, also it reloads the page (why??? it's async!!!) after the code is ran!!!
Tried jquery
Didn't work!
Any ideas?
What's annoying is it works in IE7 but not FF......
I've tried writing the code myself to no avail, now I've tried using jquery's built in ajax support and still it doesn't work. Can it get more simple than:
Code:
function insert() {
var xmlHttp;
xmlHttp=GetXmlHttpObject();
var url="insert.php?sid="+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
In Firefox the first time this runs it works and insert.php runs its SQL, however it will not work again, even after page refreshes, also it reloads the page (why??? it's async!!!) after the code is ran!!!
Tried jquery
Code:
function insertPost(){
$.post('insert.php',{}, function() {
alert('Your data has been saved.');
});
}
Any ideas?