<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},' –
檢查答案,我用一些文本連接它。 –