enter image description herehere is my jquery function. i call this function on blue event. there are more than one records in list. i want particular **rojmel_id and weight ** on blur event but i am not able to get. can anyone help me in this issue.
<script type="text/javascript">
function getweight(thisObj)
{
var row = $(thisObj).parents('.row');
var rojmel_id = row.find('.rojmel_id').val() != '' ? row.find('.rojmel_id').val() : 0;
var dataString = "rojmel_id=" rojmel_id;
$.ajax({
type: "POST",
url: "updateWt.php",
data: dataString,
success: function (data){
}
});
}
</script>
Here is my html code
{section name=sec loop=$clientArray}
<tr>
<td>{$clientArray[sec].rojmel_date}</td>
<td>{$clientArray[sec].party_name}</td>
<td>{$clientArray[sec].item_nm}</td>
<td>{$clientArray[sec].marko}</td>
<td><input type="hidden" name="rojmel_id" value="{$clientArray[sec].rojmel_id}">
<input type="text" name="weight" value="{$clientArray[sec].weight}" onblur="getweight(this);"></td>
</tr>
{/section}
</tbody>
CodePudding user response:
Try this hope it work! and can you tell where you have been declared .row class.
Here is your solution: Solution JSBin
<!-- add class to <tr> then -->
{section name=sec loop=$clientArray}
<tr >
<td>{$clientArray[sec].rojmel_date}</td>
<td>{$clientArray[sec].party_name}</td>
<td>{$clientArray[sec].item_nm}</td>
<td>{$clientArray[sec].marko}</td>
<td><input type="hidden" name="rojmel_id" value="{$clientArray[sec].rojmel_id}">
<input type="text" name="weight" value="{$clientArray[sec].weight}" onblur="getweight(this);"></td>
</tr>
{/section}
</tbody>
<script type="text/javascript">
function getweight(thisObj)
{
var row = $(thisObj).closest('tr.row');
var rojmel_id = row.find('.rojmel_id').val() ? row.find('.rojmel_id').val() : 0;
var dataString = "rojmel_id=" rojmel_id;
$.ajax({
type: "POST",
url: "updateWt.php",
data: dataString,
success: function (data){
}
});
}
</script>