2013-05-16 132 views
2

我试图从sencha-touch发出ajax请求,但请求没有被cordova 2.7拦截。我将userAgent设置为vc头。我们早些时候使用Cordova 2.2进行相同的设置,并且Ajax请求被截获得很好。我在这里错过了什么吗?PhoneGap 2.7不拦截Ajax请求

+0

你有没有想过伊姆兰呢? – Thomas

回答

0

你可以试试这个:

$.ajax({ 
    type: //get/post/put/delete, 
    url: //Your url, 
    data://Example: JSON.stringify(credentials), 
    async: false, 
    beforeSend: function(x) { 
     if(x && x.overrideMimeType) { 
     x.overrideMimeType("application/j-son;charset=UTF-8"); 
     } 
     x.setRequestHeader("Content-Type","application/json"); 
    }, 
    dataType: "json", 
    success: function(data){ 
            }, 
    error: function(xhr, status, errorThrown){ 
            } 
}); 
0

检查白名单。在config.xml中添加 <access origin=".*"/>并尝试