SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict hiddenpearls's Avatar
    Join Date
    Dec 2007
    Location
    Pakistan
    Posts
    262
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    calling ajax request and other if/else statements

    hi guys
    i need it badly ...plz help me . i m tired of getting solution.

    i m using an ajax request for checking the validation from the DB. and then when it returns the output . i then ..implement the if/else statements ..based on that ajax output .
    strange thing is that ..when i copy the output in a variable ..

    it alert me empty and then ..it shows me output in alert.

    i m manipulating the statements on the base of that output.
    plz see the code

    var abcc=' ';

    xmlhttp.open("GET", cc+'?jobsector_ID='+ str1+'&function_ID='+ str + '& r=' + Math.random(),true);
    xmlhttp.onreadystatechange = updatePage;
    function updatePage() {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
    {

    obj.innerHTML= xmlhttp.responseText;
    abcc= xmlhttp.responseText;
    alert(abcc);
    //alert(abcc.length);

    }}
    xmlhttp.send(null);

    after this output .. i m taking 2 alerts .. it shows me strange results ..

    plz test it

    alert(abcc);
    alert(abcc);

  2. #2
    Guru in training bronze trophy SoulScratch's Avatar
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    1,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, first of all I don't know exactly what your xmlhttp function does SPECIFICALLY. Secondly, what are you referencing with the obj variable? More code please.


Bookmarks

Posting Permissions

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