J'ai des appels ajax imbriqués qui ne fonctionnent pas dans IE7. Ils fonctionnent bien dans Firefox. Le fichier de service dans le deuxième $ .post n'est pas entré du tout. En d'autres termes, si la première ligne de mon fichier de service est print 'bonjour'; Je ne le vois jamais ... même si j'ajoute un fichier console.log dans le fichier $ .post pour la réponse. Je l'ai vu cette question dans d'autres endroits aussi ... http://www.mail-archive.com/[email protected]/msg34270.htmlLes appels ajax imbriqués ne fonctionnent pas dans IE7
/**
* Listener for saving page content to the database and an associative flat file
*
* @return void
*/
$(document).ready(function()
{
// Listen for the save button click
$('#save-button').live('click', function()
{
// Disable the save button just in case of repeat submits
$('#save-button').attr('disabled', 'disabled');
// Loop through the micro template children
$('#micro-template').children().each(function()
{
var id = $(this).attr('id');
// Remove random content from the DOM for this node
$(this).find('.random-content').remove();
// Remove divs that don't matter (contains edit buttons)
$(this).find('.' + id).remove();
// Remove unwanted area (contains edit buttons)
$(this).find('.remove').remove();
// Remove firebug div
$(this).find('#_firebugConsole').remove();
// Remove the class definition for the current item
$(this).removeAttr('class');
// Loop through the children's children
$(this).children().each(function()
{
// Remove mouseover actions
$(this).removeAttr('onmouseover');
// Remove divs with no data
if ($(this).html() == '')
{
$(this).remove();
}
// Remove empty styles
if ($(this).attr('style') == '')
{
$(this).removeAttr('style');
}
});
// Get the DOM HTML for this node
var html = $(this).html();
// Get the properties for the page
$.post('../services/getsession.php', function(session)
{
// Setup the content result
var obj = {
obj: session,
data: html,
microdiv: id
};
// Insert the content result for the node into the databse
$.post('../services/addContent.php', obj, function(response)
{
// Check for errors
if (response != 'success')
{
var msg = '<p class="user-error"><b>Error</b><br />Failed to add your content. Reason: ' + response + '</p>';
$('#micro-template').append(msg);
var $err = $('#micro-template').find('.user-message');
if ($err.is(':visible'))
{
// Slides out a DOM element with the class 'user-message' after 2 seconds
$(this).delay(2000,function(){
$err.slideUp('slow');
self.close();
});
}
return false;
}
else
{
$(opener.document).find('#step-three-div').hide();
$(opener.document).find('#step-one-div').show();
$(opener.document).find('form').css('width', '70%');
$(opener.document).find('form').css('height', '460px');
var $err = $('#micro-template').find('.user-message');
if (!$err.is(':visible'))
{
var msg = '<p class="user-message"><b>Information</b><br />Successfully added your content</p>';
$('#micro-template').append(msg);
var $err = $('#micro-template').find('.user-message');
if ($err.is(':visible'))
{
// Slides out a DOM element with the class 'user-message' after 2 seconds
$(this).delay(2000,function(){
$err.slideUp('slow');
self.close();
});
}
}
}
});
});
});
});
});
Je ne sais pas pourquoi vous avez deux articles ici. Pouvez-vous ne pas déplacer la fonctionnalité dans getsession.php dans une méthode appelée depuis addContent.php. Vous pouvez passer toutes les variables dont vous avez besoin dans la requête de publication unique, puis exécuter addContent.php et obtenir la même réponse. –
hey, voir ma solution j'ai rencontré ce genre de problème aussi. –