使用JQuery / AJAX发送文本值到PHP [英] Sending A Text Value To PHP Using JQuery/AJAX
本文介绍了使用JQuery / AJAX发送文本值到PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法弄清楚这一点。我有这个HTML
< input type =textclass =studno>< input type =button value =Checkclass =chstudno>
如何使用JQuery / AJAX将其发送给PHP?我有这个代码,但我认为它是错误的
var boom ='booming';
$(document).ready(function(){
$(。chstudno)。click(function(){
$(。inup)。html (boom);
studnoch();
});
});
函数studnoch(){
var studno = $('。studno')。val();
$ .post(prochat.php,{studno:studno};
}
至于php文件,这是一个简单的命令,用于检查输入变量是否与数据库中的任何内容匹配。
您可能意思是:
$ $ p $ $(。studno)。click(function(){
或:
$(。chstudno)。click(function(){
而不是:
$ b $
$(。check)。click(function(){
$ p $
$ b
检查
是值而非类:< input type =buttonvalue =Checkclass =chstudno>
I can't figure this out. I have this HTML
<input type="text" class="studno"><input type="button" value="Check" class="chstudno">
How can I send this to PHP using JQuery/AJAX? I have this code but I think it's wrong
var boom = 'booming'; $(document).ready(function(){ $(".chstudno").click(function(){ $(".inup").html(boom); studnoch(); }); }); function studnoch(){ var studno = $('.studno').val(); $.post("prochat.php", {studno: studno}; }
As for the php file, it's a simple command that will check if the input variable matches any thing on the database.
解决方案You probably meant:
$(".studno").click(function(){
Or:
$(".chstudno").click(function(){
Instead of:
$(".check").click(function(){
check
is the value not the class:<input type="button" value="Check" class="chstudno">
这篇关于使用JQuery / AJAX发送文本值到PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文