jQuery AJAX help needed

[QUOTE=everclear;5355586]This function works nicely except it’s based on an interval, how can I adapt it so it only fires once.

$(document).ready(function() {
$.ajaxSetup({ cache: false }); // This part addresses an IE bug. without it, IE will only load the first number and will never refresh
setInterval(function() {
$('#txtSummary').load('http://localhost/example/comp333assn1/php/group_list.php?q=all_contacts')
}, 3000); // the "3000" here refers to the time to refresh the div. it is in milliseconds.
});

[/QUOTE]

Hi,
i have submitted a form and the query to retrieve the form details is in xyz.php
when i do $(‘#xxx’).load(‘xyz.php’) in the above code, the query from the database is not reflected.
kindly help,
thanks!

My form action attribute is calling abc.PHP which inserts value to the database!

Hi,

There is no obvious error in the code you posted (apart from a missing semi-colon).

What is in xyz.php?

It contains code to retrieve data from database.
From firebug console I see the PHP script is not loading but only the HTML scripts are loading

Without any further information, I can only suggest that it is an error in your PHP script.

What happens if you specify a callback function that is executed when the request completes.?

$('#txtSummary').load('http://localhost/example/comp333assn1/php/group_list.php?q=all_contacts', function( response, status, xhr ) {
  if ( status == "error" ) {
    var msg = "Sorry but there was an error: ";
    console.log( msg + xhr.status + " " + xhr.statusText );
  }
});

Ref: http://api.jquery.com/load/