Encoding problem with ajax

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abdoelmasry
    New Member
    • Oct 2006
    • 104

    Encoding problem with ajax

    Hi Men

    please help me to solve this problem

    i have textbox in html page

    i require arabic data from php page using method POST with ajax to view in the textbox

    i always got a strange sympols in the textbox

    although it works fine when view the recieved data in <div>

    is this problem with the textbox

    i think there is a way to specify data encoding before post it with ajax

    im using this code to post data :

    [PHP]xmlhttp.open("p ost",serverpage ,true);
    xmlhttp.setRequ estHeader("Cont ent-type", "applicatio n/x-www-form-urlencoded");
    xmlhttp.setRequ estHeader("Cont ent-length", datatopost.leng th);
    xmlhttp.setRequ estHeader("Conn ection", "close");[/PHP]
    or
    should i do some thing to change textbox encoding ?

    Greeting
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    that seems quite strange ... the characters appear in different ways in an input-element vs. a normal div? do you have a testpage online where this could be reproducable and where we could have a closer look at? ...

    kind regards

    Comment

    • abdoelmasry
      New Member
      • Oct 2006
      • 104

      #3
      Ok Man

      Im Writing Script for Photo Shop

      I make my script support Ajax To view data without refresh

      here is my page :


      just click on refresh button and look at the customer name textbox

      the arabic characters will be changed to strange Sympols

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5388

        #4
        i tested it with firefox ... and besides a problem with the reference to the 'ordiv'-node in the request's (started in line 47 of the script) callback the response itself seems to be correct ... when i refresh the second time the code seems to work fine? what browser do you use? did you check it with different browsers?

        kind regards

        Comment

        • abdoelmasry
          New Member
          • Oct 2006
          • 104

          #5
          Hey man

          Im Using Internet explorer 6

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5388

            #6
            could you try it with firefox too please just to be sure that it work correctly ... as i said it seems to with my firefox here ... just the issue with the first reference to the 'ordiv' node? besides that ... why do you refresh the customer name too? wouldn't it be enough to refresh the prices/positions?

            kind regards

            Comment

            • abdoelmasry
              New Member
              • Oct 2006
              • 104

              #7
              Ok Man

              i changed requst metho to GET

              I Have No problem now

              Thank U Prof

              Comment

              Working...