0
$(document).ready(function(e) {

    $('#btn_emials').click(function(e) {
        var emails=$('#txt_emails').val();
        $.ajax({
            url:"../eoe/eoe_ajax.php",
            type:"POST",
            data:{emails:emails},
            success: function(d){               
                if(d=="u"){
                    alert("Unfinished Task");
                }
            },
            error: function(e){
                alert("java error");
            }
        });
    });

    get_status();   
    setInterval( function() { get_status(); }, 5000 );


    function get_status(){

        $.ajax({
            url:"../eoe/live.php",
            success:function(data){
            alert(data);
                var v=data.split(",");
                var g=v[0];
                var b=v[1];
                var n=v[2];


                FusionCharts.setCurrentRenderer('javascript');
               var myChart = new FusionCharts( "Column3D.swf", "myChartId2", "400", "200", "0", "0" );
                 myChart.setXMLData('<chart>' +
                                    '<set label="Good" value="'+g+'"  color="CC99FF"/>' +
                                    '<set label="Bad" value="'+b+'" color=" #00BFFF"/>' +
                                    '<set label="Yet to be" value="'+n+'" color="#FF7F50"/>' +
                                    '</chart>');
                myChart.render("chartContainer1");


                tot=parseInt(g)+parseInt(b)+parseInt(n);
                d=parseInt(g)+parseInt(b);
                /*alert(tot);
                alert(d); */
                var p=d*100/tot;
                p=Math.round(p);
                p1=p*5;
                $('.pbar_fill').width(p1+'px');
                $('.perc').html(p+"%");
                $('.fin_no').html(d);
                //alert(p);
            },
             error:function (xhr, ajaxOptions, thrownError){
                 alert("live error");
                }    
        });
    }

});

here for every 5 sec calling live.php page through get_status() function,if onclick on that verify button it will go to eoe_ajax.php page to verify emails which v sent to that page....but live.php is not execute untill eoe_ajax.php finished email verification....in eoe_ajax.php file v r using jar file inside eoe_ajax.php to verify email ids....

so i want to get live.php page for every 5 secs...pls help me...thanks...

5
  • How about clearing the interval when the verification button is triggered and then start it again when the ajax call eoe_ajax.php to finishes... ? Commented Aug 28, 2012 at 11:34
  • It's working for me... changed alerts to logs (less annoying) Every +/-5 sec a log live error (404) and afther click javascript error (also 404 because the pages don't exist) Commented Aug 28, 2012 at 11:35
  • setInterval( function() { get_status(); }, 5000 ); Commented Aug 28, 2012 at 11:36
  • setInterval( function() { get_status(); }, 5000 ); before onclick of verify button it will load eoe/live.php page for every 5 sec but after onclick of verify button it will go inside tat get_status() function but it will not call eoe/live.php page Commented Aug 28, 2012 at 12:03
  • not working for me.. it is not executing eoe/live.php page untill eoe/eoe_ajax.php page execution finished when onclick of verify button Commented Aug 28, 2012 at 12:09

2 Answers 2

1

Seems this might be a PHP issue. If you work with sessions with your application, there can be only one script accessing the session at the same time. http://php.net/manual/en/function.session-write-close.php

Sign up to request clarification or add additional context in comments.

Comments

0

Just use async on false after $.ajax({:

$.ajax({
...
async: false,
...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.