工作我只是有:response.split( 「」)[0]不是在IE
<script>
$('#blah').on('click', function(){
$.ajax({
type: 'POST',
url: 'ajax.php',
data: {"xxx":"yyy", "zzz":"nnn"}, // my variables...
success: function(response){
// response = "success,123" from server side
// so for accessing to the values "success" and "123" I just:
status = response.split(",")[0];
count = response.split(",")[1];
// now "status" and "count" are undefined in IE while it's working in all other browsers
}
});
});
</script>
正如可以在上面的代碼中看到,服務器響應於Ajax是 「成功,123」 。
訪問到值「成功」和「123」我做的:
status = response.split(",")[0];
count = response.split(",")[1];
現在status
和count
在IE
不確定的,而他們在每一個其他瀏覽器好。
我應該怎麼做才能解決這個問題? 謝謝
日可能會有所幫助:http://stackoverflow.com/questions/20395060/javascript-split-not-working-in-ie9-lower –
試試這個:response.toString()。split(「,」)[0]; –
@ C-link無法正常工作 – behz4d