当 Cherrypy 包含“&”时拆分表单参数
Cherrypy splitting form argument when it contains "&"
我正在将以下表单提交给 python Cherrypy 脚本,但是这是将“&”从表单参数中拆分出来,我不希望发生这种情况,而是希望得到以下输出。
期望的输出:
{'mate': u'(NSW) Ryde - Upgrade of Power Supplies to New Chillers on
Roof Design Construction P2 (RYDZ) (IMC152) (44159)'}
形式 post link:
"GET
/project_details?mate=(NSW)%20Ryde%20-%20Upgrade%20of%20Power%20Supplies%20to%20New%20Chillers%20on%20Roof%20Design%20&%20Construction%20P2%20(RYDZ)%20(IMC152)%20(44159)
HTTP/1.1"
这里是 Cherrypy 使用下面的代码看到的参数的打印输出,
{' Construction P2 (RYDZ) (IMC152) (44159)': u'', 'mate': u'(NSW) Ryde
- Upgrade of Power Supplies to New Chillers on Roof Design '}
Python代码:
@cherrypy.expose
def project_details(self, **mate):
print mate
Html代码:
$.ajax({url: 'http://192.168.0.37:8000/project_details?mate='+selectvalue,
success: function(output) {
alert(output);},
感谢 Ignacio,我已经解决了这个问题,ajax 下面的代码;
$.post( "http://192.168.0.37:8000/project_details", { mate: selectvalue})
.done(function( data ) {
alert( "Data Loaded: " + data );
});
我正在将以下表单提交给 python Cherrypy 脚本,但是这是将“&”从表单参数中拆分出来,我不希望发生这种情况,而是希望得到以下输出。
期望的输出:
{'mate': u'(NSW) Ryde - Upgrade of Power Supplies to New Chillers on Roof Design Construction P2 (RYDZ) (IMC152) (44159)'}
形式 post link:
"GET /project_details?mate=(NSW)%20Ryde%20-%20Upgrade%20of%20Power%20Supplies%20to%20New%20Chillers%20on%20Roof%20Design%20&%20Construction%20P2%20(RYDZ)%20(IMC152)%20(44159) HTTP/1.1"
这里是 Cherrypy 使用下面的代码看到的参数的打印输出,
{' Construction P2 (RYDZ) (IMC152) (44159)': u'', 'mate': u'(NSW) Ryde - Upgrade of Power Supplies to New Chillers on Roof Design '}
Python代码:
@cherrypy.expose
def project_details(self, **mate):
print mate
Html代码:
$.ajax({url: 'http://192.168.0.37:8000/project_details?mate='+selectvalue,
success: function(output) {
alert(output);},
感谢 Ignacio,我已经解决了这个问题,ajax 下面的代码;
$.post( "http://192.168.0.37:8000/project_details", { mate: selectvalue})
.done(function( data ) {
alert( "Data Loaded: " + data );
});