Hello Ryan
I found the error looks like my module names axon made
because i rewrite all the program just use express module
it can success get post data from ie ajax request
so now I'm looking for axon socket useful information to adjust the axon
can't get the normal post data problem
i use the sub socket to get the data
it still looks strange
-----------------------------------------------------------------
aaa.js
var
config = require('../config/index'),
store = config.store,
env = config.env,
axon = require('axon'),
coerce = require('./helpers/index');
// pushing down the pipleline
// auth -> quota -> validation -> router -> etc..
var pushSocket = axon.socket('push');
pushSocket.format('json');
// subscribing to the response
var subSocket = axon.socket('sub');
subSocket.format('json');
store.get(env+'__network:object', function(err,cnx){
// connection to the different sockets
pushSocket.connect(cnx.pp_facadeToAuth);
subSocket.connect(cnx.ps_sinkToFacade);
})
var lres = [];
subSocket.subscribe('aaa:*');
function saveRes(queryKey,res){
lres[queryKey]={res:res}
}
subSocket.on('message',function(topic,data){
lres[data.queryKey].res.send(data)
lres.pop(data.queryKey)
});
exports.create = function(req, res){
saveRes(req.queryKey,res);
req.body = coerce.StringToNum(req.body);
// send the receievd req params
var obj = {
format : 'JSON',
method : 'specialday:create',
queryTime : req.queryTime,
queryKey : req.queryKey,
callStack : ['properties'],
data : req.body,
}
pushSocket.send(obj);
};
i have console.log req.body it's still empty
Ryan於 2013年1月4日星期五UTC+8上午11時38分12秒寫道:
>
> XDomainRequest is VERY limited. See
> http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx
>
> The only Content-Type supported is "plain/text". If you're using Express
> check out https://github.com/senchalabs/connect/issues/355.
>
>
> On Thursday, January 3, 2013 7:03:29 AM UTC-8, [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
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