JavaScript ajax GET Not working (Service Data not getting)

We have URL when we hit URL URL in browser we got data. We got Data like

[{"UserId":"c2fbd9fb-a423-4d33-9ea4-3aa58f7b52cf","UserType":"Parent","OutPutMessage":"Sucess"}].

But We need get data through ajax call.we tried like this

window.onload = function (){
 $.ajax({
url:'http://janasenanews.com/MyService.asmx/GetUserLoginVerification',
         data: {
             username:"9440325333",
             password :"9440325333"
         },
         type: "GET",
         dataType: 'JSON',
         success:function(data) {
            alert( data);
              //console.log("Here is the data", data);
         }
    });
    }

But We got two error

Failed to load resource: the server responded with a status of 500 (Internal Server

XMLHttpRequest cannot load  Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 500.

Please guide to us what wrong in our code.

Answer:1

Change your script with:

window.onload = function (){
$.ajax({
     url:'http://janasenanews.com/MyService.asmx/GetUserLoginVerification',
     data: {
         username:"9440325333",
         password :"9440325333"
     },
     type: "GET",
     dataType: 'JSON',
     success:function(data) {
        alert( data);
          //console.log("Here is the data", data);
     }
});
}
Answer:2

I want to access the developer tools on this domain "http://umang.gov.in" using F12 or right click of the mouse but the site website developer block this option. I follow this step to access this. ...

I want to access the developer tools on this domain "http://umang.gov.in" using F12 or right click of the mouse but the site website developer block this option. I follow this step to access this. ...

  1. how to unblock developer tools on chromebook

I am developing an Ember-cli app with ember 2.1. I created a templates/loading.hbs and several other templates. My foo template has a input that I use to send a queryParam to foo/bar. foo/bar uses the ...

I am developing an Ember-cli app with ember 2.1. I created a templates/loading.hbs and several other templates. My foo template has a input that I use to send a queryParam to foo/bar. foo/bar uses the ...

I'm using rooms to send a 'private' message to a client and it works however the message being sent is duplicated by the number of clients I have and I believe this is because of my .on('message') ...

I'm using rooms to send a 'private' message to a client and it works however the message being sent is duplicated by the number of clients I have and I believe this is because of my .on('message') ...

Why are there two sets of parenthesis here? return state.filter(({ id }) => { return id !== action.id }); I'm having such a tough time wrapping my head around this one ...

Why are there two sets of parenthesis here? return state.filter(({ id }) => { return id !== action.id }); I'm having such a tough time wrapping my head around this one ...