5 Replies Latest reply on Jul 4, 2013 9:58 PM by AdobeUser999123

    Why batch run the script will block the ajax call?

    AdobeUser999123

      I added a script that call an ajax to write text file, However, the script is run as usual in the acrobat program. However, if I run the sequence file through batch , the ajax call will be blocked. That means, I can only write two times no matter there are many ajax request

       

       

       

       

       

      Ajax code: (Get the filepath and create an ajax function)

       

       

      filePath = this.path;

       

       

      ajax = app.trustedFunction(function(fURL) {

       

       

          app.beginPriv();

         

          fURL = fURL + '?path=' + filePath;

       

       

          var params = { cVerb:"GET", cURL:fURL, oHandler:{

       

       

              response:function(msg,uri,e,h){}}};

       

       

          Net.HTTP.request(params);

       

       

          app.endPriv();

      });

       

       

      Ajax code: (make an ajax request, I suspect that is caused by too frequent ajax call but in fact it is not)

       

      app.setTimeOut( ajax("http://localhost/DEV/ajax_optipng1.7/check.php") , 10000 ) ;

       

       

      PHP code: (call this file to write text file)

      <?php

      if (isset($_GET["path"])) {

                $productName = explode("/", $_GET["path"]);

                $fileName = $productName[count($productName) - 1];

                $productName = $productName[count($productName) - 4];

                require_once ('folderConfig.php');

                $processedFile = array();

       

                if (file_exists($statusFile)) {

                          $processedFile = json_decode(file_get_contents($statusFile));

                }

       

                array_push($processedFile, $fileName);

                file_put_contents($statusFile, json_encode($processedFile));

      }

      ?>

       

      How to fix the problem? I would provide any extra information to clear the situation , thanks