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 8 of 8
  1. #1
    New Coder
    Join Date
    Dec 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Help ,Ajax,and php (Updating data)

    Hello, I user This Code in My site I want help
    • when i try to enter data from my site admin cp its not add to the result in my ajax page if i open it befor enter data that i want to show from my admin but if try to delete temp files from explorer the new data apper why ?
    • i am use 2 Element in my code i want to make new function when i call this function it request the 1st Element (Callmain) and inside this open the 2nd Element (ajaxTest)

    Thx For Your Help

    Code:
    function createRequestObject() {
       var req;
       if(window.XMLHttpRequest){
          req = new XMLHttpRequest();
       } else if(window.ActiveXObject) {
          req = new ActiveXObject("Microsoft.XMLHTTP");
       } else {
          alert('حصل خطأ في طلب الصفحة...الرجاء المحاولة مرة أخرى وإذا لم تنفع جرب أن تنزل نسخة جديدة من المتصفح');
       }
       return req;
    }
    
    var http = createRequestObject();
    
    function sendRequestGet(letter) {
       http.open('get', 'Show.php?letter='+letter, true);
       http.onreadystatechange = handleResponse;
       http.send(null);
    }
    function sendRequestalbum(SingerID) {
       http.open('get', 'Showsong.php?SingerID='+SingerID, true);
       http.onreadystatechange = handleResponse;
       http.send(null);
    }
    function sendRequestalbumsongs(AlbumID) {
       http.open('get', 'Showsong.php?AlbumID='+AlbumID, true);
       http.onreadystatechange = handleResponse;
       http.send(null);
    }
    
    function handleResponse() {
       var ajaxTest = document.getElementById("ajaxTest");
       ajaxTest.innerHTML = '<div  id="genLoading"><img src="images/progressbar.gif" alt="Loading Content" border="0" /><div>Loading Content</div></div>';
       if(http.readyState == 4 && http.status == 200){
          var response = http.responseText;
          if(response) {
             ajaxTest.innerHTML = response;
          }
       }
    }
    function sendRequestsong() {
       http.open('get', 'Showsong.php', true);
       http.onreadystatechange = handleResponsex;
       http.send(null);
    }
    function handleResponsex() {
       var callmain = document.getElementById("callmain");
       callmain.innerHTML = '<div  id="genLoading"><img src="images/progressbar.gif" alt="Loading Content" border="0" /><div>Loading Content</div></div>';
       if(http.readyState == 4 && http.status == 200){
          var response = http.responseText;
          if(response) {
             callmain.innerHTML = response;
          }
       }
    }
    function sendRequestsmain(letter) {
       http.open('get', 'Showsong.php', true);
       http.onreadystatechange = handleResponsex;
             http.send(null);
    
          
      
    }
    Last edited by aymanstar; 12-10-2006 at 05:40 AM.

  • #2
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm not sure I understand your problems but in regard to your first bullet point I wanted to let you know a problem that I have had.

    Internet Explorer seems to set XML retrieved by AJAX in the cache and will wait until the expiration date is hit before it is refreshed (even if you refresh the page). The only way I know to fix this problem is to have your server set the expiration date as "now" or the current date/time or whatever to let IE know the cached version needs to be refreshed.

    So the HTTP header can have things like:

    Cache-Control: no-cache
    Expires: Sat, 9 Dec 2006 00:00:00 GMT

    How you set those will depend on your backend solution.

    Hopefully that helps.

    david_kw

  • #3
    New Coder
    Join Date
    Dec 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thx david_kw
    about am use 2 Element in my code i want to make new function when i call this function it request the 1st Element (Callmain) and inside this open the 2nd Element (ajaxTest) ?
    what i will do ?

  • #4
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is this with an XML return? Can you show me a sample XML file?

  • #5
    New Coder
    Join Date
    Dec 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    NO http request

    i put inside my html for example

    in main requested page

    Code:
    <div id="" dir="ltr"></div>
    and inside it put in center down for example
    Code:
    <div id="ajaxTest" dir="ltr"></div>
    i can call each one lonly (Alone)
    Example
    from home page click AJAX lnk
    register form apper (callmain)
    and if click ajax2
    register apper and page x aper in center mid (ajaxTest)
    but i need to call ('callmain' and 'ajaxTest' inside 'callmain'
    my code
    Code:
    function createRequestObject() {
       var req;
       if(window.XMLHttpRequest){
          req = new XMLHttpRequest();
       } else if(window.ActiveXObject) {
          req = new ActiveXObject("Microsoft.XMLHTTP");
       } else {
          alert('حصل خطأ في طلب الصفحة...الرجاء المحاولة مرة أخرى وإذا لم تنفع جرب أن تنزل نسخة جديدة من المتصفح');
       }
       return req;
    }
    
    var http = createRequestObject();
    
    function sendRequestGet(letter) {
       http.open('get', 'Show.php?letter='+letter, true);
       http.onreadystatechange = handleResponse;
       http.send(null);
    }
    function sendRequestalbum(SingerID) {
       http.open('get', 'Showsong.php?SingerID='+SingerID, true);
       http.onreadystatechange = handleResponse;
       http.send(null);
    }
    function sendRequestalbumsongs(AlbumID) {
       http.open('get', 'Showsong.php?AlbumID='+AlbumID, true);
       http.onreadystatechange = handleResponse;
       http.send(null);
    }
    
    function handleResponse() {
       var ajaxTest = document.getElementById("ajaxTest");
       ajaxTest.innerHTML = '<div  id="genLoading"><img src="images/progressbar.gif" alt="Loading Content" border="0" /><div>Loading Content</div></div>';
       if(http.readyState == 4 && http.status == 200){
          var response = http.responseText;
          if(response) {
             ajaxTest.innerHTML = response;
          }
       }
    }
    function sendRequestsong() {
       http.open('get', 'Showsong.php', true);
       http.onreadystatechange = handleResponsex;
       http.send(null);
    }
    function handleResponsex() {
       var callmain = document.getElementById("callmain");
       callmain.innerHTML = '<div  id="genLoading"><img src="images/progressbar.gif" alt="Loading Content" border="0" /><div>Loading Content</div></div>';
       if(http.readyState == 4 && http.status == 200){
          var response = http.responseText;
          if(response) {
             callmain.innerHTML = response;
          }
       }
    }
    function sendRequestsmain(letter) {
       http.open('get', 'Showsong.php', true);
       http.onreadystatechange = handleResponsex;
             http.send(null);
    
          
      
    }
    Last edited by aymanstar; 12-10-2006 at 06:54 AM.

  • #6
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm sorry but I don't know the answer. Hopefully someone else can help with your issue.

  • #7
    New Coder
    Join Date
    Dec 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thx david_kw
    wait onther anser

  • #8
    New Coder
    Join Date
    Dec 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    whats up ?


  •  

    Posting Permissions

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