<form id="participantsForGd">
<span id="GroupID"></span> //in here group id is coming example: 2
<button id="GdStartTest">Start test</button>
</form>
我想发送GroupID的值给控制器使用Ajax调用我该怎么做。 这是我追加的Java脚本..我该如何发送动态附加值到控制器
$("#GroupID").append(group); //in here Example: group value=2
这是我的控制器页面调用:
$("#GdStartTest").click(function(){
$.ajax({
data: {Gd: $("#participantsForGd").serialize(), 'action': 'startGdstudents', },
我想补充一点,组ID Ajax data:
或input type=hidden
形式..我怎么能做到这一点
如何关于数据:{Gd:$(“#GroupID”)。text()....' –
它是在consle中,但在数据中它不会去,你可以建议如何连接变量..? 'var groupID = $(“#GroupID”)。text();''我试过这个|:'data:{participantsForGd:$(“#participantsForGd”)。serialize(),'action':'startGdstudents','groupid ':groupID},' –
检查答案,我用一些文本连接它。 –