在jQuery Mobile中没有Ajax的POST方法

post method without ajax in jquery mobile

本文关键字:Ajax POST 方法 jQuery Mobile      更新时间:2023-09-26

如何在jquerymobile中发送没有ajax的POST REQUEST。 我正在发送此帖子请求,该请求在黑莓操作系统 5 上不起作用,任何人都可以帮助我吗

这是我使用 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;

}