Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Ajax Problem

  1. Jan 23, 2007 #1
    When I using Ajax to validate whether the username is exist my form , I can validate it when the username is in English character but when it is chinese character , it always can't find the username in my database eventhough the username is exist . However , when I submit the form , it can find the username in the database in chinese character . What it the problem ?
     
  2. jcsd
  3. Jan 25, 2007 #2
    probably response encoding does not match its actual content (chinese characters). I think you will have more luck in fighting it on server side.
     
  4. Jan 25, 2007 #3
    What do you mean , you mean the response from mysql ? I think it is ok because it works when I submit the form but it don't works when using ajax which doesn't submit the form .What is the problem
     
  5. Jan 25, 2007 #4
    No, I think whatta meant that since AJAX has to construct a request to the server manually, it's not encoding the request correctly. Make sure AJAX is correctly encoding it.

    In AJAX, you have to manually encode everything, or use an appropriate encode function. For example, in AJAX you have to call encode to convert & to "&" or else PHP can not read it correctly.
     
  6. Jan 26, 2007 #5
    Sane, I was under impression he has a problem on client side:
    But yes, when I think about it now, you could be right. It's hard to guess without any code given.
     
  7. Jan 26, 2007 #6
    Whatta, what I had just finished describing was client side.

    AJAX is client side. A request is client side. The client builds a request, with javascript, and sends this request to a server. That's AJAX.
     
  8. Jan 26, 2007 #7
    what I had in mind is that it pulls list of names and verifies it in browser. what you seem to suggest is that it sends the username and server does verification.

    either way, it seems that encoding is set wrong at some point inbetween.
     
  9. Jan 26, 2007 #8
    I don't know how to encode it in the serverside .But I don't think is the encoding problem because I have tested it by placing an echo before validating process and it show the correct chinese words to me . Please help
     
  10. Jan 26, 2007 #9

    -Job-

    User Avatar
    Science Advisor

    How are you sending data to the server, via GET or POST?
     
  11. Jan 27, 2007 #10
    Using post .
     
  12. Feb 7, 2007 #11
    Someone please help me .
     
  13. Feb 8, 2007 #12
    elaborate.
     
  14. Feb 13, 2007 #13
    what are you mean ?
     
  15. Feb 13, 2007 #14

    -Job-

    User Avatar
    Science Advisor

    First thing you should focus on is ensuring PHP is properly receiving the data from the Ajax POST request. Is it properly formatted? On the javascript side did you escape the values using escape() before sending them to the PHP side via Ajax?
     
  16. Feb 14, 2007 #15
    i mean show us some code
     
  17. Feb 21, 2007 #16
    I think it is propely formated because I echo it at the php side after receiving the data and it show correctly .
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Ajax Problem
  1. Ajax problem (Replies: 1)

  2. Problems with zheev (Replies: 4)

  3. Jquery AJAX input (Replies: 1)

  4. Javascript problem (Replies: 6)

  5. Problem with dgesv (Replies: 5)

Loading...