weixin_33705053 2014-07-25 11:47 采纳率: 0%
浏览 43

Jsonp和jQuery Mobile

I have problems making an JSONP with jquery mobile. I can´t received the data.

I put the code:

Could someone help me?

html:

</head> 
<body> 
<script>

 $(function() {

$("#callAjax").click(function() {

    $.ajax({
        url: 'http://atcsat.es/App/ws/listadoModelos.php?callback=?',
        type: 'GET',
         dataType: 'jsonp',
        error : function (){ document.title='error'; }, 
        success: function (data) {
            alert(data);
        }
    }); 
});



});

</script>
<div data-role="page" id="page">
<div data-role="header">
    <h1>Page One</h1>
</div>
<div data-role="content">   
<input id="callAjax" type="button" value="Errores" />

</div>
<div id="listadoListas"></div>
</div>

When i execute it says [object,Object] could someone help me about it?

  • 写回答

2条回答 默认 最新

  • weixin_33704591 2014-07-25 11:52
    关注

    [object,Object] corresponds to the code "alert(data);". This means that your request is working properly. If you want to parse the data content you should probably add something like:

    for (var i in data) {
        alert(i + " : " + data[i]);
    }
    
    评论

报告相同问题?