0
以下是我的查詢結果,它發佈到我的地址頁面。這是通過使用ajax調用的php完成的。表單輸入:使用相同名稱和編號獲取唯一值
<div id="address-wrap">
<div id="report-address">3719 COCOPLUM CIR <br>
Unit: 3548<br>
COCONUT CREEK, FL 33063</div>
<div id="report-button">
<form action="report.html">
<input name="property-id[]" type="text" class="property-id" value="64638716">
<input name="submit" type="submit" value="View Report">
</form>
</div>
<div id="clear"></div>
</div>
<div id="address-wrap">
<div id="report-address">3927 COCOPLUM CIR <br>
Unit: 35124<br>
COCONUT CREEK, FL 33063</div>
<div id="report-button">
<form action="report.html">
<input name="property-id[]" type="text" class="property-id" value="64638744">
<input name="submit" type="submit" value="View Report">
</form>
</div>
<div id="clear"></div>
</div>
<div id="address-wrap">
<div id="report-address">3949A COCOPLUM CIR <br>
Unit: A<br>
COCONUT CREEK, FL 33063</div>
<div id="report-button">
<form action="report.html">
<input name="property-id[]" type="text" class="property-id" value="64639105">
<input name="submit" type="submit" value="View Report">
</form>
</div>
<div id="clear"></div>
</div>
<div id="address-wrap">
<div id="report-address">3949 COCOPLUM CIR <br>
Unit: 3602<br>
POMPANO BEACH, FL 33063</div>
<div id="report-button">
<form action="report.html">
<input name="property-id[]" type="text" class="property-id" value="64639106">
<input name="submit" type="submit" value="View Report">
</form>
</div>
<div id="clear"></div>
</div>
<div id="address-wrap">
<div id="report-address">3949 COCOPLUM CIR <br>
Unit: 3603<br>
COCONUT CREEK, FL 33063</div>
<div id="report-button">
<form action="report.html">
<input name="property-id[]" type="text" class="property-id" value="64639107">
<input name="submit" type="submit" value="View Report">
</form>
以下是我的報告頁面上的請求。我需要從表單中獲取值並將其傳遞到我的報告頁面,以便我可以追加我的ajax請求。
<script type="text/javascript">
var property-id = $('.property-id').val();
$.ajax({
url: 'http://www.domain.com/php/reports.php',
data: '?recordID=' + property-id,
success: function(data){
$('#results').html(data);
}
});
</script>
我的主要問題是我沒有從我單擊的窗體中獲取值。它給我的第一個值的列表,它64638716.我怎樣才能得到它追加正確的價值觀
預先感謝您
嘿弗朗西斯,Ajax庫是包括在內。其次,唯一值是我的記錄ID,並且已經設置並正在運行。問題是每個輸入具有相同的ID,並且通過循環生成類。那麼如何將該值傳遞到新頁面而不循環所有值(這就是它所做的)。 – user2397810
你應該展示更多預覽代碼,我會幫忙的。或創建一個jsfiddle示例 – FrancisMarfo
更新的原始發佈 – user2397810