What I want to do is: I want to run the include/sync.php file when I press the send button.
Description:
I retrieve the data from mysql database in php and display it in the order of the latest id. I put buttons on each id, send the data, and run the php file.
What is wrong with the error below?
There are from id(1) to id(10), but when I press the latest id(10), the error below appears, but when I press the other id button, it doesn't respond at all!!
Why is that?Someone please teach me.
Description Supplement: /* The following question is an error when rewriting this with aax
This works fine, but =>echo "send";*/
Error below:
SyntaxError: Unexpected identifier
1, The above error will appear on the send button below
echo "<td><arel='$test_id' href='javascript:void(0)'id='sw'>send</a></td>";
<script type="text/javascript" src="http://ajax.googleapi.com/ajax/libs/jquery/1.7.2/jquery.min.js">/script>
<script type="text/javascript">
$(document).ready(function(){
$("#sw").click(function(){
varparam={"test_id":"{$test_id}"};
$.ajax({
type: "post",
url: "includes/sync.php",
data —JSON.stringify (param),
dataType: "text",
}).done(function(data){
alert(data.text);
}).fail(function(XMLHttpRequest, textStatus, errorThrown){
alert(errorThrown);
});
});
});
</script>
The jQuery link seems to be wrong. Try fixing it to http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
. (googleapi->googleapis)
© 2024 OneMinuteCode. All rights reserved.