>From what I remember, that looks right. You could try adding console.log to
print each request as it comes in.

I eventually abandoned X-Domain requests in favor of window.postMessage,
which I think is a better solution. The postMessage function works across
domains between iframes. You load a hidden iFrame in the target domain,
then route all requests through there. No need to mess around with headers
etc.

I don't know what support is like for postMessage in IE however.


On Thu, Jan 3, 2013 at 6:48 PM, <[email protected]> wrote:

> Hello Jacob
>
> we have setting the response header like this
>
> app.all('*', function(req, res, next) {
>     res.header("Access-Control-Allow-Origin", "*");
>     res.header("Access-Control-Allow-Headers", "X-Requested-With");
>     res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
>     res.header("X-Powered-By",' 3.2.1')
>     res.header("Content-Type", "application/json;charset=utf-8");
>     if(req.method==='OPTIONS')
>       res.send(200);
>     else
>       next();
> });
>
> so is there anything we have to setting on node.js server?
>
> and how could i check the second request can be received successfully?
>
> or did you have any ie ajax success sample can show me?  because it is
> really strange
>
> thanks a lot Jacob~
>
>
> Jacob於 2013年1月4日星期五UTC+8上午1時51分14秒寫道:
>>
>> When doing a cross domain POST, the browser usually send two HTTP
>> requests. The first with HTTP method OPTIONS before sending the actual
>> request. Your server has to flag the request as okay before the browser
>> proceeds.
>>
>> Your server might be receiving the options request only, which would have
>> no body.
>>
>>
>> On Thu, Jan 3, 2013 at 8:03 AM, Tiger Nassau Inc 
>> <[email protected]>wrote:
>>
>>> You may have cors (cross origin) problems - its kind if tricky but you
>>> probsbly need a header to allow - search on this
>>>
>>> Sent from my LG Mobile
>>>
>>> [email protected] wrote:
>>>
>>> >hello
>>> >
>>> >if we use chrome or firefox we can't successfully get the jquery ajax
>>> post
>>> >data,
>>> >
>>> >but we found if we use ie9 or ie8 to send POST data by jquery ajax ,
>>> >node.js just receive empty body {}
>>> >
>>> >even we change the header like content-type to application/json or
>>> >text/plain and Accept value it still didn't work
>>> >
>>> >so is here anyone have the same problem or have any solution , please
>>> help
>>> >me  thanks a lot
>>> >
>>> >i paste my code below
>>> >
>>> >-----------------------------**--------------
>>> >
>>> >if(jQuery.browser.msie && window.XDomainRequest) {
>>> >
>>> >                       //var data=JSON.stringify({'**property_id':'**
>>> 50da64f65d396b1e48000001','**name':'222','start_date':'**2012/11/11'});
>>> >               var data='property_id=**50da64f65d396b1e48000001&id=**
>>> 222';
>>> >
>>> >               var xdr = new XDomainRequest();
>>> >               xdr.contentType= 'text/plain';
>>> >
>>> >               xdr.onload = function (e) {
>>> >            var data = $.parseJSON(xdr.responseText);
>>> >            if (data == null || typeof (data) == 'undefined') {
>>> >                alert(data)
>>> >            }
>>> >            //success
>>> >               };
>>> >                        xdr.onerror = function (e) {
>>> >                //alert(e);
>>> >               }
>>> >
>>> >                       xdr.open("POST", url);
>>> >                       xdr.send(data);
>>> >
>>> >                        }
>>> >                        else
>>> >                        {
>>> >                               $.post(url,{'property_id':'**
>>> 111','name':'222','start_date'**:'2012/11/11'}, function(data) {
>>> >                           alert(data)
>>> >                         });
>>> >                       }
>>> >
>>> >
>>> >-----------------------------**----------------------
>>> >
>>> >
>>> >$.ajax({
>>> >       beforeSend: function(xhrObj){
>>> >                xhrObj.setRequestHeader("**Content-Type","application/*
>>> *json");
>>> >                xhrObj.setRequestHeader("**Accept","application/json");
>>> >        }
>>> >  url: url,
>>> >  type: "POST",
>>> >  data: JSON.stringify({'property_id' : 'test'}),
>>> >  headers : {
>>> >                'Accept' : 'application/json',
>>> >                'Content-Type' : 'application/x-www-form-**urlencoded'
>>> >            },
>>> >            dataType: "json",
>>> >  success: function(data){
>>> >     alert(data);
>>> >  }
>>> >});
>>> >
>>> >--
>>> >Job Board: http://jobs.nodejs.org/
>>> >Posting guidelines: https://github.com/joyent/**node/wiki/Mailing-List-
>>> **Posting-Guidelines<https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines>
>>> >You received this message because you are subscribed to the Google
>>> >Groups "nodejs" group.
>>> >To post to this group, send email to [email protected]
>>>
>>> >To unsubscribe from this group, send email to
>>> >nodejs+un...@**googlegroups.com
>>>
>>> >For more options, visit this group at
>>> >http://groups.google.com/**group/nodejs?hl=en?hl=en<http://groups.google.com/group/nodejs?hl=en?hl=en>
>>>
>>> --
>>> Job Board: http://jobs.nodejs.org/
>>> Posting guidelines: https://github.com/joyent/**node/wiki/Mailing-List-*
>>> *Posting-Guidelines<https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines>
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To post to this group, send email to [email protected]
>>>
>>> To unsubscribe from this group, send email to
>>> nodejs+un...@**googlegroups.com
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/**group/nodejs?hl=en?hl=en<http://groups.google.com/group/nodejs?hl=en?hl=en>
>>>
>>
>>  --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to