从PHP返回JSON对象到ajax,但在IOS上不起作用


Returning a JSON object from PHP to ajax not working on IOS

我从PHP返回一个JSON对象到ajax。这适用于除iPhone IOS之外的所有设备。由于某种原因在IOS (chrome和safari),而不是对象被传递回ajax, JSON对象显示,而不是我的网页。(在空白屏幕上)

{"key":"value", etc } 
PHP:

die(json_encode($out));

JS:

$.ajax({
    url:         $form.attr( 'action' ),
    type:        $form.attr( 'method' ),
    data:        ajaxData,
    dataType:    'json',
    cache:       false,
    contentType: false,
    processData: false,
    success:     function( data ) {
                    // something
                 }
});
更新:

对不起,我没有给你所有的拼图碎片。看起来下面的代码破坏了我在IOS上的JS:
$("input[type=radio").change(function() {        
    $($errorMsg).removeClass('error');
    $($errorMsg).hide();
});

IOS可能不支持input[type=radio],所以我只是做了一个类:|

回答一个真实的答案:

你忘记了jQuery选择器上的右括号。

应该是:

$("input[type=radio]").change(function() { $($errorMsg).removeClass('error'); $($errorMsg).hide(); });

回头再谢我

相关文章: