Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

Why batch run the script will block the ajax call?

$
0
0

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


Viewing all articles
Browse latest Browse all 12130

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>