我有一个窗体,并需要发送文本框的值为php方。获取值文本框,并将其发送到php
我总是把我的变量的值隐藏起来,然后发送给php端。我认为这是愚蠢的。有没有办法发送这样的文本框值
$.post("adasda", {"degisken1":$("#txtEmail").val()} ,function(response){})
我有一个窗体,并需要发送文本框的值为php方。获取值文本框,并将其发送到php
我总是把我的变量的值隐藏起来,然后发送给php端。我认为这是愚蠢的。有没有办法发送这样的文本框值
$.post("adasda", {"degisken1":$("#txtEmail").val()} ,function(response){})
是的,你可以通过jQuery的ajax,发布或获取方法发送文本框的值。下面是一个示例例如
$("#searchForm").submit(function(event) {
/* stop form from submitting normally */
event.preventDefault();
/* get some values from elements on the page: */
var $form = $(this),
term = $form.find('input[name="s"]').val(),
url = $form.attr('action');
/* Send the data using post and and get the results */
$.post(url, { s: term },
function(data) {
// write your code here
}
);
});
详情请看这里http://api.jquery.com/jQuery.post/
感谢
$ .post('/ json/management/updateAllAjax', { “name”:$(“#IDname”).val() ,“orgName”:$(“# IDOrg“)。val() }, function(response){ alert(response); }); alert($(“#IDname”).val())给出的值,但我不能发送这个到PHP端 – snnlankrdsm 2012-04-18 13:02:43
看到我的上面的例子是发送值'term'与's'变量,这将转到动作url。或者,在编写post方法并提醒他们之前,最好在某些变量中获取这些值。然后尝试通过post方法发送这些变量。 – 2012-04-18 13:29:51
你应该能正常运行的代码,假设'adasda'是在你的web应用程序的有效路径。你有什么具体问题吗? – 2012-04-18 12:43:05
我只有对象数据:S – snnlankrdsm 2012-04-18 12:45:55