Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting "403 forbidden" error for ajax call web service in javascript?
    text
    copied!<p>i have a web service in a server, and i could connect web service from any browser in remote machine or host machine. But i couldn't access the web service using ajax call in javascript, showing 403 forbidden error. I ran the script from the server itself. Below is the code i used. </p> <p>$('div').live('pageshow',function(event, ui){</p> <pre><code> var username = 'vijay'; var password = 'vijay'; var domain = ''; var windowsuser = false; // var dataObject = {}; // dataObject = {Username:username,Password:password,Domain:domain,WindowsUser:windowsuser}; $('#login').click(function(){ $.ajax({ type: "POST", url: "http://xxx.xxx.x.xx/Y_NAME/REST/session.aspx", data: ({Username:username,Password:password,Domain:domain,WindowsUser:windowsuser}), // contentType: "application/x-www-form-urlencoded", cache: false, dataType: "json", timeout: 5000, success: onSuccess }); }); $("#resultLog").ajaxError(function(event, request, settings, exception) { $("#resultLog").html("Error Calling: " + settings.url + "&lt;br /&gt;HTTP Code: " + request.status); }); function onSuccess(data) { //$("#resultLog").html("Result: " + data); console.log(data[0].Name); } </code></pre> <p>Here , after calling web service, it has to return JSON data, but it didn't return anything. In firebug, inside the function onSucess, it shows 'null' for data. Do i miss anything here? Y does it show '403' forbidden error? Since i'm calling the scripts from the server where the web service located, i think its not cross domain issue. I'm using this in Jquery mobile. Help needed. Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload