且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PhoneGap的登录表单

更新时间:2023-12-04 18:12:10

首先你必须设置要检索(比如以HTML)预期的数据类型。 之后,你也必须对检索到的数据指定的函数,你suceeded检索数据之后...

first you have to set the expected dataType you want to retrieve (for example to html). After that you have to also specify a function on the retrieved data after you suceeded retrieving the data...

事情是这样的:

jQuery.ajax({ 
    type: "POST", 
    success: function(data) { // After retrieving the data from the php-file
    alert(data);}
    url: serviceURL + "login.php", 
    data: 'username='+username+'&password='+password,  
    cache: false,
    dataType:'html' // Expected return data type...
}

数据变量包含从PHP文件返回的字符串,所以你必须呼应出来的东西与PHP脚本,如登录,然后你必须过滤器/检查此字符串JavaScript的...

The data Variable contains the return string from the php file, so you have to echo something out with the php script, like "logged in" and then you have to filter / check this string with javascript...

卢西恩