Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2007
    Location
    Chennai, Tamil Nadu, India
    Posts
    71
    Thanks
    5
    Thanked 0 Times in 0 Posts

    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/
    - யானைக்கும் அடிசறுக்கும்

  • #2
    hgs
    hgs is offline
    New Coder
    Join Date
    Jan 2010
    Location
    Germany
    Posts
    83
    Thanks
    3
    Thanked 5 Times in 5 Posts
    Have a look at:

    encodeURIComponent(value)

    this might help

    Regards

  • #3
    New Coder
    Join Date
    Jan 2007
    Location
    Chennai, Tamil Nadu, India
    Posts
    71
    Thanks
    5
    Thanked 0 Times in 0 Posts

    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/
    - யானைக்கும் அடிசறுக்கும்


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •