且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

暂停代码执行

更新时间:2023-12-05 11:49:52

Heya,Nathan。


尝试直接在writeResponse()内部调用setValidationList()。


参见此主题更多i nfo。



Heya,Nathan。


尝试直接在writeResponse内调用setValidationList() ()。


请参阅此主题更多信息。



我已经阅读了另一个帖子,并且忘记了异步意味着什么感觉有点傻。


麻烦我直接调用setValidationList()是因为我无法从onreadystatechange传递参数到函数中。


如果我的代码导致cde暂停一点,没有完美的警报(如果有点软糖)。这有什么有效的方法吗?


或者有一种方法可以将参数传递给从onreadystatechange调用的函数吗?如果有,那么也许我可以将我的调用setValidationList()移动到writeResponse()。这样设置glIsValid变量的代码将在调用setValidationList()函数时执行。


感谢您的帮助到目前为止,我已经学到了很多关于这种发展。

nathj


Heya,Nathan。


我直接调用setValidationList()的麻烦是我无法从onreadystatechange传递参数到函数中。



请参阅这篇文章


Hi,

I have a strange problem, my code is running too quickly. Allow me to explain (if I can).

I am using the XMLHTTP object in order to query the database as a user completes the membership application form, basically I want to ensure that each username is unique.

I have the code to check this and the XMLHTTP object is working fine. However, before the code finishes executing the next part of the function is run. this means that the array I have for storing if items are valid or not is being populated incorrectly.

I only check the database if the first stage of validation returns true. At present I have a bit of a fudge in place in that I have added an alert box, as you can see in the code below, this seems to pause the code, which then results in the correct behaviour. Without this I get told that the username I entered is in the database but the system allows me to continue because the validation flag says true because the user name followed the regular expression in place.

Here is the code

Expand|Select|Wrap|Line Numbers

Heya, Nathan.

Try calling setValidationList() directly inside of writeResponse().

See this thread for more info.


Heya, Nathan.

Try calling setValidationList() directly inside of writeResponse().

See this thread for more info.

I have read the other thread, and felt a bit of a fool for forgetting what Asynchronous meant.

The trouble I have with calling setValidationList() directly is that I can''t pass parameters into the function from onreadystatechange.

If I code cause the cde to pause for a bit, without the alert that would be perfect (if a bit of a fudge). Is there are any effective way of doing this?

Alternatively is there a way of passing paramters into the function that is called from onreadystatechange? If there is then perhaps I can move my call to setValidationList() into writeResponse(). That way the code that sets the glIsValid variable will have executed by the time the setValidationList() function is called.

Thanks for the help so far, I have already learnt a lot more about this sort of development.
nathj


Heya, Nathan.

The trouble I have with calling setValidationList() directly is that I can''t pass parameters into the function from onreadystatechange.

See this article.


上一篇 : :如何在Linux Shell脚本中插入新行?下一篇 : 在新成立的实体,实体框架使用的导航性能

相关阅读

推荐文章