0

am working on a project and i found a little problem with my ajax request which am finding hard to fix. i want to perform multiple ajax requests, in that i mean: i need to perform an ajax request, and if its successful, i will perform another ajax request within the success handler.

here is a sample of my code:

var result;
$.post('make_payment.php',{password:pass,amount:50},function(data){
result=data;
if(result=='success'){
    $.ajax({
        type:'post',
        dataType:"json",
        url:"save_info.php",
        success: function(data){
            if(data.result=='success'){
                alert('success');   
            }
        },
        error:function(){
            alert('failed');
        }
    });
}
})

This works pretty good on mozilla firefox and google chrome, but does not work on internet explorer and apple safari. pls i need an assistance on how to make it work on all browser.

4

1 回答 1

0

尝试使用 dataType:"jsonp" 而不是 dataType:"json" 。我不确定原因,但很久以前我遇到了同样的问题,并且通过此更改得到了解决

于 2013-08-15T15:02:36.290 回答