从跨度字段提交值 [英] submit a value from span field
本文介绍了从跨度字段提交值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有提交按钮的发件人
i have a from with a submit button
使用jquery后,页面将具有:
after using jquery the page will have :
for(var i=0 ; i <10 ; i++){
'<span class="ioAddConcept">'+ currentConcept[i] +'</span>\n\
with\n\
<span class="ioAddRelation">'+ currentRelation[i] +'</span>\n\'
}
(那段代码只是一个例子)
我使用Ajax
(that piece of code is just an example)
the variables currentConcept[] and currentRelation[] i got its values from database using Ajax
**i am using PHP**
我的问题是如何使用这两个变量提交页面?
and my question how to submit the page with these two variables ?
我的意思是在服务器上我希望像这样
i mean in the server i hope something to be like this
$concepts = $_POST['currentConcept[]']
推荐答案
像这样在jQuery中获取这些值:
Get these values in jQuery like this:
var ioAddConcept = $(".ioAddConcept").html();
var ioAddRelation = $(".ioAddRelation").html();
现在您可以将这些值设置到表单文本框中:
Now you can set these values into form text boxes:
$('input.ioAddConcept').text( ioAddConcept );
$('input.ioAddRelation').text( ioAddRelation );
或(如果您通过AJAX请求提交表单)
OR if you are submit form via AJAX request:
$.ajax({
url : '/path/to/action.php',
type : 'POST',
data : 'value1=' + ioAddConcept '&value2=' + ioAddRelation,
success : function( data ) {
alert(data);
}
});
在服务器端获取这些值:
Get these values on server side:
print_r( $_POST );
这篇关于从跨度字段提交值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文