Home > front end >  Js document. The work is finished loading such as executed, but in front of the library to read data
Js document. The work is finished loading such as executed, but in front of the library to read data

Time:01-30

The following lines of code, is to do the autocomplete, to finish the SQL the read to make automatic, but there are thousands of data in SQL,
I tried, if read only 200 or so, this can be done automatically (Alert is used to test the js ever execute),
But if amplified to article 500, or all of the data, this is totally not perform,
Didn't ready state estimation is the dom, so did not perform,
What method can solve this problem?

 
<script>

Document. Write (' Hello World! ');
The $(document). Ready (function () {

Var: supplier="& lt; ? PHP echo ($supplier_tmp); ?>" The split (", ");
//the document. The write (" fsdfadf "+ : supplier [0]).
$(" # customer_id "). The autocomplete ({source: : supplier});
Alert (" hello ");
Alert (document. The readyState);

}
);
</script>

CodePudding user response:



Jump out of the code logic, the code does not perform may have two kind of situations: 1. The code before executing an error, cause the interruption to the execution of the current code
2. Code before executing judgment statements, statement cleared expected to execute the code

The code does not perform so two kinds of circumstances, which come of it?

CodePudding user response:

Is the DOM ready finished loading is executed, you may well before you return of data, that is your data haven't returned the function has been performed,

CodePudding user response:

Check the front there is a poem, the name of a table column content,
Check all does not perform, 200,
Not change to 500,
No other changes

CodePudding user response:

refer to the second floor the whole do not understand the reply:
is the DOM ready finished loading is executed, you may well before you return of data, that is you didn't return the data of this function is performed,

To the right, is this because the query the database takes time, database haven't check he has performed here, so lead to no execution,
What method can well deal with this problem?

CodePudding user response:

reference 4 floor response: small argument
Quote: refer to the second floor the whole do not understand the reply:
is the DOM ready finished loading is executed, you may well before you return of data, that is you didn't return the data of this function is performed,

To the right, is this because the query the database takes time, database haven't check he has performed here, so lead to no execution,
What method can well deal with this problem?
to show that the method to get the data of the callback, ensure the data returned in execution,
But also to change the page displays, ensure the data returned page can operation,

CodePudding user response:

refer to fifth floor whole don't understand the reply:
Quote: refer to 4th floor response: small argument
Quote: refer to the second floor the whole do not understand the reply:
is the DOM ready finished loading is executed, you may well before you return of data, that is you didn't return the data of this function is performed,

To the right, is this because the query the database takes time, database haven't check he has performed here, so lead to no execution,
What method can well deal with this problem?
to show that the method to get the data of the callback, ensure the data returned in execution,
But also to change the page displays, ensure the data page can operation, after come back


The js is not very familiar with, this should be how to get the right, put read SQL that $(document). Ready ({ on it? })

CodePudding user response:

reference 1st floor Stephen_112 response:


Jump out of the code logic, the code does not perform may have two kind of situations: 1. The code before executing an error, cause the interruption to the execution of the current code
2. Code before executing judgment statements, statement cleared expected to execute the code

The code does not perform so two kinds of circumstances, which come of it?

After the F12 check, there is indeed a data problem, there is a field in a carriage return, causing var variable times wrong, did not see before debugging, didn't found the problem, alas
  • Related