Monday, 30 September 2013

Getting error in calling web service using ajax in jquery +jquery mobile?

Getting error in calling web service using ajax in jquery +jquery mobile?

I am calling login web service.But I am not able to check what I will get
from server . I got this
**http://isuite.c-entron.de/CentronService/REST
Username: qus
Password: 1**
I check on browser
http://isuite.c-entron.de/CentronService/REST&&Username=qus?Password= 1
But not getting any thing.
Secondly I used ajax like this 404 will get .Is this way to calling web
service.
$(document).ready(function () {
//event handler for submit button
$("#btnSubmit").click(function () {
//collect userName and password entered by users
var userName = $("#username").val();
var password = $("#password").val();
//call the authenticate function
authenticate(userName, password);
});
});
//authenticate function to make ajax call
function authenticate(userName, password) {
$.ajax
({
type: "POST",
//the url where you want to sent the userName and password to
url: "http://isuite.c-entron.de/CentronService/REST",
dataType: 'json',
async: false,
//json object to sent to the authentication url
data: '{"Username": "' + userName + '", "Password" : "' +
password + '"}',
success: function () {
//do any process for successful authentication here
}
})
}
Here is fiddle http://jsfiddle.net/LsKbJ/1/

No comments:

Post a Comment