Javascript 什么';这个Ajax调用有什么问题?
我已经从一个函数编写了一个ajax调用,在单击图像时触发。在php页面上,使用php gd旋转图像。不知怎的,ajax没有被触发。我不知道我在哪里犯了错误 JQuery:Javascript 什么';这个Ajax调用有什么问题?,javascript,php,jquery,ajax,Javascript,Php,Jquery,Ajax,我已经从一个函数编写了一个ajax调用,在单击图像时触发。在php页面上,使用php gd旋转图像。不知怎的,ajax没有被触发。我不知道我在哪里犯了错误 JQuery: $(document).ready(function() { $("#rotate-head-1").click(function(){ alert("Function running"); var filename = document.getElementB
$(document).ready(function() {
$("#rotate-head-1").click(function(){
alert("Function running");
var filename = document.getElementById('image-1').getAttribute('src');
$.ajax({
url:"test.php",
type:"GET",
async:true,
data:{procedure:"rotate",file_name:filename},
cache:false
success: function(data) {
alert("Success");
}
error: function() {
alert("Failure");
}
});
});
});
HTML:
任何帮助或建议都将不胜感激。我看到的是在
缓存
和成功
选项后缺少一个逗号。这些错误应该出现在控制台中,您可以使用控制台动态调试此类问题
$(document).ready(function() {
$("#rotate-head-1").click(function(){
alert("Function running");
var filename = document.getElementById('image-1').getAttribute('src');
$.ajax({
url:"test.php",
type:"GET",
async:true,
data:{procedure:"rotate",file_name:filename},
cache:false //<-- you miss a comma here?
success: function(data) {
alert("Success");
} // <-- and miss a comma here
error: function() {
alert("Failure");
}
});
});
});
$(文档).ready(函数(){
$(“#rotate-head-1”)。单击(函数(){
警报(“功能运行”);
var filename=document.getElementById('image-1').getAttribute('src');
$.ajax({
url:“test.php”,
键入:“获取”,
async:true,
数据:{过程:“旋转”,文件名:},
cache:false//console中有错误吗?那么整个点击处理程序没有被触发吗?或者只是ajax调用吗?当我删除$.ajax中的所有内容时({..),那么“函数运行”警报就起作用了。但是当我这样做时,什么都不起作用(包括该警报)。
$(document).ready(function() {
$("#rotate-head-1").click(function(){
alert("Function running");
var filename = document.getElementById('image-1').getAttribute('src');
$.ajax({
url:"test.php",
type:"GET",
async:true,
data:{procedure:"rotate",file_name:filename},
cache:false //<-- you miss a comma here?
success: function(data) {
alert("Success");
} // <-- and miss a comma here
error: function() {
alert("Failure");
}
});
});
});