jQuery发送发布数据而不定义URL [英] jquery sending post data without defining url
本文介绍了jQuery发送发布数据而不定义URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以通过ajax或post发送数据而不定义url?这是我正在尝试的代码:
Is it possible to send data via ajax or post and not to define url? This is the code I am trying to work:
$("#gll_delete").click(function(){
var gll = $("#gll").val();
var gll_string = gll.split(' ');
var gll_id = gll_string[0];
console.log(gll_id);
var data = "gll_id=" + gll_id;
$.ajax({
type : "POST",
data : data
});
});
推荐答案
您需要为此请求指定目标.如果应该是同一页面(例如html表单上的空action属性会做出反应),则可以执行以下操作:
You need to specify a destination for this request. If it should be the same page (like an empty action attribute on a html form reacts) you could do:
url: location.href
这篇关于jQuery发送发布数据而不定义URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文