jquery - Token Authentication through web api -


i've web api on user can authenticate , token providing

grant_type=password&username=username&password=password

i tried fiddler , works perfectly. want try same webform in different application running on different server(url). i'm making jquery ajax call same

  $(document).ready(function () {                  $("#btnsubmit").click(function () {                     var credentials = "grant_type=password&username="+ $("#txtusername").val() +"&password="+ $("#txtpass").val();                     alert(credentials);                     $.ajax({                         url: 'http://localhost:54971/token',                         type: 'post',                         datatype: 'json',                         contenttype: 'application/x-www-form-urlencoded; charset=utf-8',                         crossdomain: true,                         data: json.stringify(credentials),                         complete: function (result) {                             //called when complete                             alert(result + "1");                         },                          success: function (result) {                             //called when successful                             alert(result + "2");                         },                          error: function (result) {                             //called when there error                             alert(result + "3");                         },                     });                  });             }) 

this gives error reads

xmlhttprequest cannot load http://localhost:54971/token. no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost:30580' therefore not allowed access. response had http status code 400. 

what doing wrong here.?


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -