jquery ajax response removes the + character

**Update:** It looks like the problem is when I'm reading the value from the html to begin with. This is the markup: I'm reading the value of `someval` like this and passing it to the ajax call: $.ajax({ data: 'someval=' + $("input[name=someval]").val(), success: function(resp) { $("#targetd").html(resp); alert(resp); } }); Looks like the problem happens when it concatenates `$("input[name=someval]").val()` to `data: 'someval=' +` since `$("input[name=someval]").val()` has a `+` in it. **Old** I'm making an ajax call to a php script and the response returned contains html markup. I take that response and assign it to a div after that. success: function(resp) { $("#targetd").html(resp); alert(resp); } Part of the response being returned is supposed to look like this. **(notice the `+` sign)** It's working fine and I can assign it to the div, except that for some reason the markup returned is missing the `+` sign When the php script itself outputs the markup, it works fine, but when the markup is passed to the page through an ajax response the `+` disappears. I'm not doing anything special to the markup, as the code above shows, I'm just taking it as is as soon as it's returned and assigning it to the div. When I alert the response directly, the `+` is also missing so not just when it gets assigned to the div. Not sure what could be going on here.
Please post the portion of your php code that is generating the ajax response

以上就是jquery ajax response removes the + character的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏