Reputation: 251
I'm trying to call a php page which essentially parses my xml and if there's changes in the xml, it inserts that data into a mysql table.
My code originally was:
var auto_refresh = setInterval(
function ()
{
$('.blabla').load('parser.php');
}, 10000); // refresh every 10000 milliseconds
where .blabla was an empty div and parser.php did not echo any information - I only called the php to check the xml.
Rather than call the php every 10 seconds which seems a bit unnecessary, I want to call the php before my page loads.
How would I go about doing that?
This is what I have got so far:
$(document).ready(function() {
$('.blabla').load('parser.php');
});
which is not working.
Upvotes: 2
Views: 111
Reputation: 1969
Try
$(document).ready(function() {
$('.blabla').load('parser.php', function()
{
//just to see if you loaded the php
alert("loaded yay!");
});
});
If there is no message, the problem maybe the php.
Upvotes: 1