我的结构如下:
echo 'something' on x.php;
x.php -> Requests to y.php;
while(x.php -> waiting Response from y.php)
do something;
但是它不起作用,因为服务器被锁定在请求并且在获得响应打印之后 '某事物'在屏幕上。
注意:它不像加载..'我想要的结构,它完全不同。
编辑: 请求代码部分就像(不是实际代码):
while(5){
echo 'hey hey';
}
$whatIWant = 'wanted string';
$myTopicString = 'topic34593495';
while(strlen($myTopicString)>2){
$url = 'y.php/'.$myString;
$r = request($url);
$response = response($r);
if(strpos($response,$whatIWant))
break;
$myTopicString -= 1;
}
我想要的是印刷'嘿嘿'屏幕上的字符串,并在请求之前查看。
答案 0 :(得分:0)
看来你正在尝试为AJAX做一些事情。 所以请查看http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/
答案 1 :(得分:0)
如果您的脚本很重并需要一些严重的加载时间,那么您应该考虑使用AJAX。所以首先要显示主屏幕元素。之后,您使用JavaScript检索数据。