Home  >  Article  >  Backend Development  >  transport.js/run() error:'process_request' is undefined_PHP tutorial

transport.js/run() error:'process_request' is undefined_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:49:26906browse

Using ECshop’s AJAX (ie: transport.js)

Sometimes IE will appear: ReferenceError: process_request is not defined, and FF will appear: transport.js/run() error: undefined. In fact, this has nothing to do with transport.js. So what's the problem?

(1) First find lines 445-447 and find these two sentences:

/* Define two aliases */
var Ajax = Transport;
Ajax.call = Transport.run;

(2) Then I found 735 and found this sentence:

Ajax.onRunning = showLoader;

Haha... Actually the problem lies in the showLoader function in this sentence. Because there is this statement

in line 753 of this function

if (! obj && process_request), and the above problem occurs because the variable process_request is not defined! !

(3) Why is it said that the variable is not defined?

The reason is very simple, because EC often uses this sentence:

Put it at the end... Of course the above error will appear when there is some other processing, JS loading, JS running, but before it reaches the bottom!!!

What is the use of the process_request variable? In fact, it is to create a DIV layer to display the message "Your request is being processed..."! ! Why is it implemented this way? Because this can support multiple languages.

Solution:

(1) Add the sentence var process_request = 'Processing your request...' in the showLoader function body; if it is in English, it will be changed to English. . .

(2) Place the sentence var process_request = "{$lang.process_request}"; in the