Bug Tracker

Opened 15 years ago

Closed 15 years ago

Last modified 9 years ago

#2239 closed bug (worksforme)

plus sign (+) in data: element of ajax not sent to server

Reported by: dasacc22 Owned by:
Priority: minor Milestone: 1.2.3
Component: ajax Version: 1.2.2
Keywords: + plus Cc:
Blocked by: Blocking:


I have tried escape()'ing the plus sign and i have tried sending it just as is, but the server does not get it, below i do both by appending my escaped form data to "my+content", again, server does not receive any plus signs.

function submitform() {
	article = $("#article").val();
	header = escape($("#header").val());
	content = escape($("#content").val());
		type: "POST",
		url: "article_save.php",
		data: "article="+article+"&header="+header+"&content=my+content"+content,
		success: function(html) {

Change History (2)

comment:1 Changed 15 years ago by davidserduke

Resolution: worksforme
Status: newclosed

The problem is for an encoded URI the plus sign means spacebar. escape() has been deprecated in javascript. It should work using encodeURIComponent() instead. Or you can let jQuery do it for you by passing in an object with your data like

  type: "POST",
  url: "article_save.php",
  data: {
    article : $("#article").val(),
    header : $("#header").val(),
    content : $("#content").val()
  success: function(html) {

That should also work (assuming I didn't make any typos or mental errors).

Try those out and if you still find there is a bug you can reopen the ticket. Hope that helps.

comment:2 Changed 9 years ago by [email protected]

$( "#cackulatr input" ).on('change',function() {

var z = $("#nambr1").val();

var h = $("#nambr2").val(); var w = $("#nambr3").val(); var k = z + h ; alert(k)

Note: See TracTickets for help on using tickets.