Hi All,
I have a login HTML form as shown below:
<div id="wrap">
<div id="window" caption="Login">
<div>
<table>
<tr>
<td>Username:</td>
<td><input style="width: 150px;" type="text" name="user" id = "username" /></td>
</tr>
<tr>
<td>Password:</td>
<td><input style="width: 150px;" type="password" name="password" id = "password" /></td>
</tr>
<tr>
<td colspan="2" align="right" valign="bottom">
<input type="button" id="submit" value="Login" />
</td>
</tr>
</table>
</div>
</div>
I am making a POST Ajax call like the following:
jQuery(document).ready(function () {
var loginUrl = "/MyWebApp/authenticate"
$( "#submit" ).click(function(e) {
e.preventDefault();
var userNAME = $("#username").val();
var passWord = $("#password").val();
var ajaxRequest = jQuery.ajax({
data: {
username: userNAME,
password: passWord
},
dataType: "json",
method: "POST",
url: loginUrl
})
.done(function (data_, textStatus_, jqXHR_) {
// Some code here
})
.fail(function (jqXHR_, textStatus_, errorThrown_) {
alert("Hitting the Fail function : Error in authenticate webservice: " + errorThrown_);
return false;
});
});
When I type on my browser https://mydomainname.com/
, I see the alert window mentioned in the fail function above with the message : Hitting the Fail function : Error in authenticate webservice: Method Not Allowed
. The same I see in the browser console as well like the following:
POST https://mydomainname.com/MyWebApp/authenticate 405 (Method Not Allowed)
Could anyone please tell me what’s wrong I am doing? Is it SSL related issue? Or is there a way I can stop the prepending of URL https://mydomainname.com
and can have just absolute path displayed on browser console like the following POST /MyWebApp/authenticate