用“+”符号jQuery的Ajax调用 [英] Jquery ajax call with '+' sign

查看:96
本文介绍了用“+”符号jQuery的Ajax调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  $。阿贾克斯({
    类型:POST,网址:baseURL时+SYS / formTipi_azioni数据:az_tipo =+动作类,
    beforeSend:函数(){$(#表)HTML('< P>< IMG SRC =+的baseUrl +'的lib / IMG / AJAX-loader.gifWIDTH =16高度=16 ALT =装载/>< P>');},
    成功:函数(HTML){$(#表)HTML(HTML);}
 });
 

存在这样的情况时,动作类的

  TB +
 

加号没有得到所有贴出来,一个空格被发送。我已经尝试过这样的:

 动作类=逃生(字符串(动作类));
 

由于没有运气。有谁知道如何解决这一问题?

感谢您

解决方案

 动作类=逃生(字符串(动作类));
 

 动作类= EN codeURIComponent(字符串(动作类));
 

或只是

 动作类= EN codeURIComponent(动作类);
 

$.ajax({  
    type: "POST", url: baseURL+"sys/formTipi_azioni",data:"az_tipo="+azione,
    beforeSend: function(){$("#form").html('<p><img src="'+baseURL+'lib/img/ajax-loader.gif" width="16" height="16" alt="loading" /><p>');},
    success: function(html){$("#form").html(html);}  
 });

there is a case when azione is

TB+ 

the plus sign doesn't get POSTed at all, a blank space get sent. I already tried this:

azione = escape(String(azione));

With no luck. Does anybody knows how to fix this?

Thank you

解决方案

azione = escape(String(azione));

should be

azione = encodeURIComponent(String(azione));

or simply

azione = encodeURIComponent(azione);

这篇关于用“+”符号jQuery的Ajax调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆