Php 如何从ajax传递两个值
目前,我正在使用onlick事件将一个值从ajax传递到phpPhp 如何从ajax传递两个值,php,mysql,ajax,Php,Mysql,Ajax,目前,我正在使用onlick事件将一个值从ajax传递到php <a href="#" id="<?php echo $row['cat_id'];?>" onclick="showCat(this.id)" >click </a> 我想做的是,我想从ajax代码中传递另一个值。 这是我想要传递的值 <input type="text" value="<?php echo $resname;?>" name="another" />
<a href="#" id="<?php echo $row['cat_id'];?>" onclick="showCat(this.id)" >click </a>
我想做的是,我想从ajax代码中传递另一个值。
这是我想要传递的值
<input type="text" value="<?php echo $resname;?>" name="another" />
您可以使用$(“input[name='other']).val()
获取文本框值,并将其传递给代码中提到的ajax调用参数
function showCat(id) {
var resname = $("input[name='another']").val(); //here you can getvalue of your textbox
//make the ajax call
$.ajax({
url: 'ajax_categ.php',
type: 'GET',
data: {option : id, resname : resname},
success: function(data) {
document.getElementById('meal').innerHTML =data;
}
});
}
您可以使用$(“input[name='other']).val()
获取文本框值,它可以传递给代码中提到的ajax调用参数
function showCat(id) {
var resname = $("input[name='another']").val(); //here you can getvalue of your textbox
//make the ajax call
$.ajax({
url: 'ajax_categ.php',
type: 'GET',
data: {option : id, resname : resname},
success: function(data) {
document.getElementById('meal').innerHTML =data;
}
});
}
您可以使用$(“input[name='other']).val()
获取文本框值,它可以传递给代码中提到的ajax调用参数
function showCat(id) {
var resname = $("input[name='another']").val(); //here you can getvalue of your textbox
//make the ajax call
$.ajax({
url: 'ajax_categ.php',
type: 'GET',
data: {option : id, resname : resname},
success: function(data) {
document.getElementById('meal').innerHTML =data;
}
});
}
您可以使用$(“input[name='other']).val()
获取文本框值,它可以传递给代码中提到的ajax调用参数
function showCat(id) {
var resname = $("input[name='another']").val(); //here you can getvalue of your textbox
//make the ajax call
$.ajax({
url: 'ajax_categ.php',
type: 'GET',
data: {option : id, resname : resname},
success: function(data) {
document.getElementById('meal').innerHTML =data;
}
});
}
编辑函数,使其接受两个参数:
<a href="#" id="<?php echo $row['cat_id'];?>" onclick="showCat(this.id, '<?php echo $resname;?>')" >click </a>
function showCat(id, resname) {
//get the selected value
//make the ajax call
$.ajax({
url: 'ajax_categ.php',
type: 'GET',
data: {option : id, resname: resname},
success: function(data) {
document.getElementById('meal').innerHTML =data;
}
});
}
函数showCat(id,resname){
//获取所选的值
//进行ajax调用
$.ajax({
url:'ajax_categ.php',
键入:“GET”,
数据:{option:id,resname:resname},
成功:功能(数据){
document.getElementById('MEIN').innerHTML=data;
}
});
}
编辑函数,使其接受两个参数:
<a href="#" id="<?php echo $row['cat_id'];?>" onclick="showCat(this.id, '<?php echo $resname;?>')" >click </a>
function showCat(id, resname) {
//get the selected value
//make the ajax call
$.ajax({
url: 'ajax_categ.php',
type: 'GET',
data: {option : id, resname: resname},
success: function(data) {
document.getElementById('meal').innerHTML =data;
}
});
}
函数showCat(id,resname){
//获取所选的值
//进行ajax调用
$.ajax({
url:'ajax_categ.php',
键入:“GET”,
数据:{option:id,resname:resname},
成功:功能(数据){
document.getElementById('MEIN').innerHTML=data;
}
});
}
编辑函数,使其接受两个参数:
<a href="#" id="<?php echo $row['cat_id'];?>" onclick="showCat(this.id, '<?php echo $resname;?>')" >click </a>
function showCat(id, resname) {
//get the selected value
//make the ajax call
$.ajax({
url: 'ajax_categ.php',
type: 'GET',
data: {option : id, resname: resname},
success: function(data) {
document.getElementById('meal').innerHTML =data;
}
});
}
函数showCat(id,resname){
//获取所选的值
//进行ajax调用
$.ajax({
url:'ajax_categ.php',
键入:“GET”,
数据:{option:id,resname:resname},
成功:功能(数据){
document.getElementById('MEIN').innerHTML=data;
}
});
}
编辑函数,使其接受两个参数:
<a href="#" id="<?php echo $row['cat_id'];?>" onclick="showCat(this.id, '<?php echo $resname;?>')" >click </a>
function showCat(id, resname) {
//get the selected value
//make the ajax call
$.ajax({
url: 'ajax_categ.php',
type: 'GET',
data: {option : id, resname: resname},
success: function(data) {
document.getElementById('meal').innerHTML =data;
}
});
}
函数showCat(id,resname){
//获取所选的值
//进行ajax调用
$.ajax({
url:'ajax_categ.php',
键入:“GET”,
数据:{option:id,resname:resname},
成功:功能(数据){
document.getElementById('MEIN').innerHTML=data;
}
});
}
1。在all_task()中传递两个参数
onclick="all_task('<?=$all?>','<?=$project_id?>');"
1。在all_task()中传递两个参数
onclick="all_task('<?=$all?>','<?=$project_id?>');"
1。在all_task()中传递两个参数
onclick="all_task('<?=$all?>','<?=$project_id?>');"
1。在all_task()中传递两个参数
onclick="all_task('<?=$all?>','<?=$project_id?>');"
欢迎来到Stack Overflow,@shwetakushwaka!虽然这段代码可能会回答这个问题,但提供有关它如何和/或为什么解决问题的附加上下文将提高答案的长期价值。欢迎使用堆栈溢出@shwetakushwaka!虽然这段代码可能会回答这个问题,但提供有关它如何和/或为什么解决问题的附加上下文将提高答案的长期价值。欢迎使用堆栈溢出@shwetakushwaka!虽然这段代码可能会回答这个问题,但提供有关它如何和/或为什么解决问题的附加上下文将提高答案的长期价值。欢迎使用堆栈溢出@shwetakushwaka!虽然这段代码可以回答这个问题,但提供关于它如何和/或为什么解决问题的附加上下文将提高答案的长期价值。