Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-02-2010, 10:20 AM   PM User | #1
jayapalchandran
New Coder

 
Join Date: Jan 2007
Location: Chennai, Tamil Nadu, India
Posts: 69
Thanks: 4
Thanked 0 Times in 0 Posts
jayapalchandran is an unknown quantity at this point
ajax post containing ambersand & issue

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???
__________________
http://vikku.info/
- யானைக்கும் அடிசறுக்கும்
jayapalchandran is offline   Reply With Quote
Old 02-02-2010, 03:35 PM   PM User | #2
hgs
New Coder

 
Join Date: Jan 2010
Location: Germany
Posts: 52
Thanks: 1
Thanked 2 Times in 2 Posts
hgs is on a distinguished road
Have a look at:

encodeURIComponent(value)

this might help

Regards
hgs is offline   Reply With Quote
Old 02-02-2010, 06:06 PM   PM User | #3
jayapalchandran
New Coder

 
Join Date: Jan 2007
Location: Chennai, Tamil Nadu, India
Posts: 69
Thanks: 4
Thanked 0 Times in 0 Posts
jayapalchandran is an unknown quantity at this point
oh yes... forgot totally

Oh nice, since i started using my own function i totally forgot these built in functions... thank you
__________________
http://vikku.info/
- யானைக்கும் அடிசறுக்கும்
jayapalchandran is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:54 PM.


Advertisement
Log in to turn off these ads.