Skip to main content

Bug Tracker

Side navigation

#2239 closed bug (worksforme)

Opened January 25, 2008 09:29PM UTC

Closed January 25, 2008 10:42PM UTC

Last modified December 23, 2013 12:20PM UTC

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:
Description

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.

<script>
function submitform() {
	article = $("#article").val();
	header = escape($("#header").val());
	content = escape($("#content").val());
	alert(content);
	$.ajax({
		type: "POST",
		url: "article_save.php",
		data: "article="+article+"&header="+header+"&content=my+content"+content,
		success: function(html) {
			$("#debug").html(html);
		}
	});
}
</script>
Attachments (0)
Change History (2)

Changed January 25, 2008 10:42PM UTC by davidserduke comment:1

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

$.ajax({
  type: "POST",
  url: "article_save.php",
  data: {
    article : $("#article").val(),
    header : $("#header").val(),
    content : $("#content").val()
  },
  success: function(html) {
    $("#debug").html(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.

Changed December 23, 2013 12:20PM UTC by hovog@gmail.com comment:2

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

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

var h = $("#nambr2").val();

var w = $("#nambr3").val();

var k = z + h ;

alert(k)