[英]how to use ajax in jQuery in javascript
I want to post javascript variable to another php file and I search using Ajax may help.I want to get back the data on another php file by "post" method.But I can't use $.ajax({}) directly inside javascript: 我想将javascript变量发布到另一个php文件中,我使用Ajax搜索可能会有所帮助。我想通过“ post”方法获取另一个php文件中的数据。但是我不能直接在$ .ajax({})内部使用javascript:
function input() {
$.ajax({
url : 'update_service.php',
type : 'POST',
data : {
name: name,
},
success : function(response) {
alert(response);
}
});
The error message said "unexpected function ajax()". 错误消息说“意外的函数ajax()”。 How to fix it?
如何解决?
JQuery Version jQuery版本
$.post( "update_service.php", function( data ) {
alert( "Data Loaded: " + data );
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.