[eluser]davidino86[/eluser]
hi,
i'm tryng to make an application with jquery.ajax the concept is:
send a form selized (first ajax call)with a click event when it started make a loading layer displayed and clear html of the form layer, when stopped make the loading layer hidden and append to form layer, through the $.get() function, another page.but the problem is that every each get function the ajaxStart event is called going into a loop that load the next pages.
this is the function:
Code:
$(document).ready(function ()
{
var urlProcessData = 'step/saveResult';
$('.btn_submit').click(function(x)
{
// al click del bottone faccio partire la prima chiamata ajax
var x = $.ajax({
url: urlProcessData,
type: 'post',
data: $('#Form').serializeArray(),
cache: false
});
});
$().ajaxStart(function (event, request, settings)
{
$('#loading').fadeIn(); // faccio comparire il div con la gif di loading
$('#box_test').fadeOut(function(){
$(this).html(" "); //svuoto il contenuto del div box test
});
});
$().ajaxStop(function()
{ $('#loading').hide();
var y = $.get('ajax/' + ajaxpage + '.php', 'html', function(data)
{
$('#box_test').fadeIn(function()
{
$(this).append(data);
});
//alert(y);
});
});
});
for each next page to append i put this javascript on top all of page.
I hope in a help