简体   繁体   中英

jquery mobile login parse json response in jquery mobile

We need JSON response

http:/host/MyService/MyService.svc/GetAuthenticatedUserData/Himansu/hits@123

when I hit the above URL in the browser, I got a response like this

{"GetAuthenticatedUserDataResult":1}

Can anyone tell me how to pass the two values (Himansu/hits@123) through code?

We tried like this:

var user = "Himansu";
var pw = "hits@123";
var authToken = null;
$.ajax({
    url: 'http://192.168.3.136/MyService/MyService.svc/GetAuthenticatedUserData/',
    type: "POST",
    contentType: 'application/json',
    data: JSON.stringify({ "Name" : user, "Password" : pw}),
    success: function(data)
    {
    alert("goodDay");
    } 
 });

but no luck.

Base on your question and comments, you need to allow Access-Control-Allow-Origin on your back end side / web service.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM