1
我嘗試將一個ID值放在每個記錄的無線電檢查元素後面。它在VIEW方面工作正常,但現在我想獲得這個ID VIA JQuery選擇器並將其POST在ajax上。 我的HTML看起來如下:獲取與jquery選擇器檢查行值id
<td>
<input type="radio" name="cursa_radio" id="cursa_radio" value="ticket_selected" route_value ="'.$data['route'][$i]['id'].'">
'.$data['route'][$i]['departure_station'].' //actual td value
</td>
這是我的ajax:
$.ajax({
url: MyVariable.urlsite + "curse_interne/getInternalTicketPrice",
type: "POST",
dataType: 'json',
data: $("#first_step").serialize()
+ '&internal_route_id=' + $("input[name='cursa_radio']:checked ").text('value')
+ '&' + $("#first_step").serialize(),
注意網址的網站是我的contorller文件和getInternalTicketPrice是我的函數,只有這個:
$a = $this->input->post('internal_route_id');
在控制檯上,我得到:
string(15) "[object Object]"
任何想法如何返回route_value ="'.$data['route'][$i]['id'].'"
的實際值? 謝謝!
使用'.val()'not'.text('value')'。此外,你追加序列化表格數據兩次 –
相同...我得到字符串(15)「[對象對象]」 –