0

how to send post request without ajax in jquerymobile. i am sending this post request which is not working on blackberry OS 5 .can anyone please help me

Here is my post method with ajax which is working fine. But now I want to send post data without 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;

}

PPD
  • 5,072
  • 11
  • 45
  • 82
  • Somewhat duplicate of: http://stackoverflow.com/questions/133925/javascript-post-request-like-a-form-submit – Cranio Jun 21 '12 at 10:27

1 Answers1

0

The simple answer is to use <form method="post" data-ajax="false" ... >

I ran into a problem doing that. The POST went fine, but reloads of the page did not. Not sure if it's related or not.

https://stackoverflow.com/questions/11163206/jquery-mobile-1-1-0-post-reloads-as-get

Community
  • 1
  • 1