访问我的Windows Phone应用程序的Json数据时总是出错

时间:2014-03-20 10:07:11

标签: ajax json windows-phone-7

以下代码无法用于我的Windows应用程序。 它始终返回“system.collections.generic.dictionary 2 system.string system.object”错误。 我尝试用文本替换json,它返回成功但无效的数据。

$.ajax({ dataType: "json", url :$(this).attr('action'), type : 'POST', data : { 'action' : $('#action').val(), 'user' : $.trim($('#user_id').val()), 'password' : $.trim($('#password').val())
}, success : function(response) { if(response=="Error") { isUserLogged=false; $.mobile.hidePageLoadingMsg(); alert("Authentication Failed"); } else { isUserLogged=true; machinenames = response; server_names =[]; var temp1 = [],i=0,head='',id=''; for(var index in machinenames) { head = machinenames[index]; id = index; temp1.push({heading:head,machid:id}); } if(temp1.length>0) { server_names.push({'server_names':temp1}); }
$.mobile.changePage('#machines_page', {transition:'slide'}); }
}, error : function(error) { isUserLogged=false; $.mobile.hidePageLoadingMsg(); alert(Error); //alert("Error: Authentication Failed");
} });

0 个答案:

没有答案