[英]post method without ajax in jquery mobile
how to send post request without ajax in jquerymobile. 如何在jquerymobile中发送不带ajax的帖子请求。 i am sending this post request which is not working on blackberry OS 5 .can anyone please help me 我正在发送此帖子请求,该请求在Blackberry OS 5上不起作用。有人可以帮助我吗?
Here is my post method with ajax which is working fine. 这是我使用ajax的post方法,效果很好。 But now I want to send post data without ajax. 但是现在我想发送不带ajax的帖子数据。
function handleLogin(){
var form = $("#loginForm");
var u = $("#username", form).val();
var p = $("#password", form).val();
var d = $("#dob", form).val();
if(u != '' && p!= '')
{
var finalStr = u+encodeURIComponent("|^")+p+encodeURIComponent("|^")+encodeURIComponent("|^")+"X"+encodeURIComponent("|^")+d+encodeURIComponent("|^")+"1.0"+encodeURIComponent("|^|$");
var encodedURL = encodeURI("http://myDomain/Ri_logon.asp?requestString=");
var parameters = decodeURIComponent(finalStr);
$.ajax({
type: "POST",
contentType:"application/x-www-form-urlencoded; charset=UTF-8",
url: encodedURL,
data: parameters
}).done(function( msg )
{
response = msg
console.log("repon se::>::"+response);
var substr = response.split('$');
var str = substr[1];
var substrtest = substr[1].split('|^');
if(response.charAt(0)=='0')
{
$.mobile.changePage('UI/Equity/home.html')
}
else
{
alert( "Alert : " + msg );
}
});
}
else
{
navigator.notification.alert("You must enter a username and password", function() {});
$("#submitButton").removeAttr("disabled");
}
return false;
} }
The simple answer is to use <form method="post" data-ajax="false" ... > 简单的答案是使用<form method =“ post” data-ajax =“ false” ...>
I ran into a problem doing that. 我在这样做时遇到了一个问题。 The POST went fine, but reloads of the page did not. POST运行正常,但页面重新加载没有。 Not sure if it's related or not. 不确定是否相关。
https://stackoverflow.com/questions/11163206/jquery-mobile-1-1-0-post-reloads-as-get https://stackoverflow.com/questions/11163206/jquery-mobile-1-1-0-post-reloads-as-get
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.