Need some AJAX/PHP/Array help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #16
    In my opinion the eval should be without the Array() as in:
    [PHP]eval(ajaxObject s[indexThis].response);[/PHP]
    Suggest you put an alert in front of the eval
    [PHP]alert (ajaxObjects[indexThis].response);[/PHP]
    and the alert should also show:
    Code:
    formObj.firstname.value='Luie';
    formObj.lastname.value='Lugo';
    formObj.location.value='Pennsylvania';
    Ronald :cool:

    Comment

    • LuiePL
      New Member
      • Sep 2006
      • 24

      #17
      Well this is interesting... I threw in the alert and it shows this:

      [HTML]<html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title>Untitl ed Document</title>
      </head>

      <body>

      formObj.firstna me.value = 'Luie';
      formObj.lastnam e.value = 'Lugo';
      formObj.locatio n.value = 'Pennsylvania';
      formObj.about.v alue = 'Web Team, Dispatcher 370, Author';

      </body>
      </html>[/HTML]

      However, on the page it only shows:

      [HTML]formObj.firstna me.value = 'Luie';
      formObj.lastnam e.value = 'Lugo';
      formObj.locatio n.value = 'Pennsylvania';
      formObj.about.v alue = 'Web Team, Dispatcher 370, Author';[/HTML]

      When I throw in Array() around ajax response it shows it as undefined. So there's a problem somewhere only getting the formObj information from the getMember page.

      Comment

      • LuiePL
        New Member
        • Sep 2006
        • 24

        #18
        OK I got rid of the HTML tags in the getMember.php file (something that shouldn't have been there to begin with), so it's no longer giving me all the code, however, it's still not populating the fields as it should.

        Comment

        • LuiePL
          New Member
          • Sep 2006
          • 24

          #19
          YES!!! OK, well I was looking through the code some more, and tried to display the whole eval(Array()) thing and it was showing as undefined, so I dropped the Array() and now it's working. So I guess it had to do with the HTML tags, now that they're gone, it's working!

          I just have to fiddle with the Location a little, since it's a drop down right now, but at least it's working. Thanks for the help guys!

          Comment

          • ronverdonk
            Recognized Expert Specialist
            • Jul 2006
            • 4259

            #20
            As I said in my entry yesterday, you had to get rid of the array() because the eval() function accepts only a code string!

            I am still confused about the reason why you use arrays and indexes. I thought this really was a straight-forward application like: you type in a number and I will get the associated data from the database. But it obviously is not.
            Anyway, good luck!

            Ronald :cool:

            Comment

            • LuiePL
              New Member
              • Sep 2006
              • 24

              #21
              Originally posted by ronverdonk
              As I said in my entry yesterday, you had to get rid of the array() because the eval() function accepts only a code string!

              I am still confused about the reason why you use arrays and indexes. I thought this really was a straight-forward application like: you type in a number and I will get the associated data from the database. But it obviously is not.
              Anyway, good luck!

              Ronald :cool:
              I went through my test page and got rid of the Array it it works with out it. So I got rid of it on my live page, and it works there also, so I'm thinking it was only necessary when I had the HTML tag issue.

              Now the only issue I've run into is it not working in firefox. Throughout the testing it never worked, so it's not something that I suddenly changed that stopped it. I threw up a message on the live page telling the people that they have to use IE for it to work properly, so I'm too concerned about it.

              Comment

              • ronverdonk
                Recognized Expert Specialist
                • Jul 2006
                • 4259

                #22
                I am not knowledeable enough to advise you on your Firefox/Ajax issue, but you could visit the Round-up of 30 AJAX Tutorials link and see if anyone of those authors can help you out here.

                Good luck!

                ROnald :cool:

                Comment

                • LuiePL
                  New Member
                  • Sep 2006
                  • 24

                  #23
                  OK, I'll look through those when I get some time. Thanks for all your help in getting this to work.

                  Comment

                  • theprodigy
                    New Member
                    • Jul 2007
                    • 1

                    #24
                    I know that this is a little late in the ballgame considering the date you posted your last reply, but Firefox and other Mozilla based browsers don't use the ActiveXObject (which is the only thing your ajax.js is looking for).

                    For Firefox and other Mozilla based browsers, you want to use:

                    XMLHttpRequest

                    as in

                    Code:
                    request = new XMLHttpRequest;
                    Not sure if you needed this or not, but thought it would be helpful

                    *Edit: Nevermind, I see where the XMLHttpRequest is. I was looking at the original one posted on htmlgoodies.

                    Comment

                    Working...