Looking For Ajax advice

Discussion in 'Programming' started by Anim9or, Jan 11, 2011.

  1. #1
    Hi,

    I've been working on a photo processing website for about a year now and I'm in the process of remodelling it and I could use some help. Basically, most photo manipulation is done using php files. Oriignally, I would have a page redirect to one of these files then use the PHP redirect to move away from this. This wasn't a very good idea so I got some advice to use ajax. Since then, I've been trying to learn ajax and have been trying to learn ajax and have used a few simple methods to call the PHP files using methods like:

    
    function loadXMLDoc()
    {
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
        }
      }
    xmlhttp.open("GET","moma.php",true);
    xmlhttp.send();
    }
    
    Code (markup):
    Buuuuuuuuuuuuuuut unfortunatley it's not really working out. The idea is great and a million times better than what I was working with, but I can't help but find that it isn't always successful. Every now and then it stops midway or never loads and tracking progress on my website I can tell something has gone wrong that keeps them from continuing.

    So I was wondering if anyone can recommend a better idea for calling PHP documents, so far I haven't had much success with getting results this way :p
     
    Anim9or, Jan 11, 2011 IP
  2. underground-stockholm

    underground-stockholm Guest

    Messages:
    53
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try jQuery.
     
    underground-stockholm, Jan 11, 2011 IP