Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

Threaded View

  1. #1
    Sencha User
    Join Date
    Jun 2012
    Vote Rating
    fsuarez is on a distinguished road


    Default Answered: Cant POST JSON data to https REST API via Ext.Ajax while GET is possible

    Answered: Cant POST JSON data to https REST API via Ext.Ajax while GET is possible


    Im trying to use Ext.Ajax to post some data as JSON to a Rest API server. Its a cross domain request but the server uses CORS. Im able to do GET and retrieve JSON data with no problems but when trying to do a POST it fails. In the following code I try to do a login
         login = function (callerInstance, user, pass, onLogin) {
            var url = SERVER + "login";
            var data = {};
            data.username = user;
            data.password = pass;
                url: url,
                method: 'POST',
                jsonData: data,
                success: function(response, opts) {
                    console.log(TAG + 'responseText: ' + response.responseText);
          , LOGGED_IN, response.responseText);
                failure: function(response, opts) {
                    console.log(TAG + 'server-side failure with status code ' + response.status);
                    console.log(TAG + 'responseText: ' + response.responseText);
          , NOT_LOGGED_IN, response.responseText);
    The result of this is
    HosRestApi: server-side failure with status code 0 
    And if I comment out the jsonData line, I get this error:
    HosRestApi: server-side failure with status code 500
    HosRestApi: responseText: {"errorText":"Internal Server Error: Object reference not set to an instance of an object."}
    So the server is trying to process the request but failing as there is no login data.
    So Im not sure why is the first error I mentioned happening or where is happening, or whats the problem.
    The URL is https, does that makes any difference?
    Please help me on this one!

  2. It was a CORS problem after all. To get my server supporting CORS Im using the following configuration:

    	<add name="Access-Control-Allow-Origin" value="*" />
    	<add name="Access-Control-Allow-Methods" value="GET, POST, DELETE, OPTIONS" />
    	<add name="Access-Control-Allow-Headers" value="origin, content-type, x-requested-with" />
    In the web.config file (its a IIS server). I hope this helps someone

Thread Participants: 1

Tags for this Thread