jayapalchandran
02-02-2010, 10:20 AM
Hi, I am back again with clarification in ajax post.
I am having a WYSIWYG (TinyMCE) editor for a description field.
I am posting it using AJAX.
Assume that the data is "lorum ispum & <p>sample text<p>"
so it will be like
var udescription = "lorum ispum&sampletextandothertext";
xmlhttp.open("POST","ajax.php?description="+udescription",true);
Obviously this will get posted as usual form the client side.
But the server parses it as
Array (
[udescription] = [lorum ispum],
[sampletextandotherext] = ''
)
that is, any letters after an ambersand is consider as a key and it searches for the '=' sign to take the value next to it...
so if i send "ajax.php?name=joe&number=989898&description=sample&one&two"
it will be like
name = joe
number = 989898
description = sample
one =
two =
So what i think is doing a base64encode here and doing a base64decode in the server side.
I have base64encode function for javascript.
Will this solution holds good or am i m i s s i n g something.
Do people have an alternate or a suggestion. Please provide any kind of info so that we forum users will update it.
How does a browser send data to the server. hope it sets the mime type to base64 and the server would check it and decode it.
The post data would be 7 bit, 8bit and base64 and then multipart data seperated by boundaries.
so we have to set a different content type or use additional methods of XMLHTTPRequest???
I am having a WYSIWYG (TinyMCE) editor for a description field.
I am posting it using AJAX.
Assume that the data is "lorum ispum & <p>sample text<p>"
so it will be like
var udescription = "lorum ispum&sampletextandothertext";
xmlhttp.open("POST","ajax.php?description="+udescription",true);
Obviously this will get posted as usual form the client side.
But the server parses it as
Array (
[udescription] = [lorum ispum],
[sampletextandotherext] = ''
)
that is, any letters after an ambersand is consider as a key and it searches for the '=' sign to take the value next to it...
so if i send "ajax.php?name=joe&number=989898&description=sample&one&two"
it will be like
name = joe
number = 989898
description = sample
one =
two =
So what i think is doing a base64encode here and doing a base64decode in the server side.
I have base64encode function for javascript.
Will this solution holds good or am i m i s s i n g something.
Do people have an alternate or a suggestion. Please provide any kind of info so that we forum users will update it.
How does a browser send data to the server. hope it sets the mime type to base64 and the server would check it and decode it.
The post data would be 7 bit, 8bit and base64 and then multipart data seperated by boundaries.
so we have to set a different content type or use additional methods of XMLHTTPRequest???