var xmlHttp = new XMLHttpRequest();
var httpData = { action: 'read', key: 'test', keyfmt: 'text', outfmt: 'xml', version: '1', product: 'test' };
xmlHttp.open('POST', url, true);
XMLHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttp.send(format(httpData));举个简单的例子。如上格式的httpData,怎么格式化成需要的格式?'action=read&key=test&...',好像参数还要encode,请教一下,jquery什么的那里面写的看不懂,还有httpData的格式用这种好不好?反正这样容易修改参数的值。httpData.action='insert'什么的方便点,但是不好改成传参数需要的格式。有没有其他格式既容易修改值又容易转成需要的格式?
var httpData = { action: 'read', key: 'test', keyfmt: 'text', outfmt: 'xml', version: '1', product: 'test' };
xmlHttp.open('POST', url, true);
XMLHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttp.send(format(httpData));举个简单的例子。如上格式的httpData,怎么格式化成需要的格式?'action=read&key=test&...',好像参数还要encode,请教一下,jquery什么的那里面写的看不懂,还有httpData的格式用这种好不好?反正这样容易修改参数的值。httpData.action='insert'什么的方便点,但是不好改成传参数需要的格式。有没有其他格式既容易修改值又容易转成需要的格式?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货