如果标题正确LOL IDK的,但让我解释一下
LOL idk if the title correct, but let me explain
嗨.. jQuery的AJAX荫新手,这里有一些问题
Hi.. Iam newbie on jquery ajax and have some problem here
现在我已经分贝呼吁url.sql这种格式
right now i have db called url.sql with this format
tbl_url
----------------------------------------------------
+ url_id + url_link +
----------------------------------------------------
+ 1 + http://somelink.com/page/2/ +
----------------------------------------------------
+ 2 + http://somelink.com/page/3/ +
----------------------------------------------------
也有PHP code称为run.php像这样的
also have php code called run.php like this one
<?php
$h = "localhost";
$u = "root";
$p = "root";
$d = "url";
$c = mysql_connect("$h","$u","$p");
if (!$c) die ("Fail");
mysql_select_db($d,$c) or die ("db cant find");
$url_query=mysql_query('select * from url');
include('simple_html_dom.php');
$html = new simple_html_dom();
while($url_row=mysql_fetch_row($url_query)) {
$eachpage=$urlpost_row['url_link'];
$html = file_get_html($eachpage);
foreach($html->find(".class h2") as $eachtitle){
$eachtitle = $eachtitle->plaintext;
echo $eachtitle."<br/>";
$submit_query = mysql_query("INSERT INTO tbl_url(url_link) VALUES('$eachtitle')");
}
}
?>
然后叫form.html
and then html file called form.html
<input type="button" id="display" value="Process All Data" />
<div id="responsecontainer" align="center">
</div>
我的问题是如何做一个jQuery的Ajax的处理run.php
My question is how to do an jquery-ajax to process the run.php
我的意思是,我想它是这样的:
I mean i want its look like this:
当我点击form.html按钮,run.php将与5秒延迟的每一行,我问这个使用jQuery,AJAX,因为url.sql有很多行,避免超时在PHP我$使用AJAX而不是参数或者set_time_limit p $ PFER
When i click button on form.html, the run.php will work with 5 second delay for each row, i ask this using jquery-ajax because the url.sql have lot of rows, to avoid timeout on php i prefer using ajax rather than set_time_limit
我真的空白/零有关jQuery的阿贾克斯
i really blank / zero about jquery-ajax
谢谢:)
推荐答案
您可以调用的onclick以下code
You can call the below code on onclick
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
jQuery.ajax({
url:'YOUR PHP url',
type:'POST',
data:'SEND YOUR DATA',
success:function(results){
jQuery("#oresponsecontainer").html(results);
}
});
相关推荐
最新文章