Is it possible to use js variables in the ajax call?
function getArticleData()
{
var values = {};
$.each($('#orders-form').serializeArray(), function(i, field) {
values[field.name] = field.value;
});
var rowNo = values.row_no;
var artNoField = "art_no"+rowNo;
var artAmField = "art_amount"+rowNo;
var art_no = values[artNoField];
var art_amount = values[artAmField];
<?php
echo CHtml::ajax(array(
'url'=>CController::createUrl('orders/getArticleData'),
'data'=>array('rowNumber'=>'js:$(\'#row_no\').val()',
'articleNumber'=>'js:$(\'#art_no\').val()',
'articleAmount'=>'js:$(\'#art_amount\').val()',
),
'type'=>'post',
'dataType'=>'json',
'success'=>"function(data)
{
// Update the status
$('#articleStatus').html(data.status);
if (data.error=='false')
{
$('#art_name').val(data.art_name);
$('#art_price').val(data.art_price);
//$('#art_price_all').val(data.art_price_all);
}
} ",
))?>;
return false;
}
I want to use the art_no variable instead of the jquerry code (js:$(\’#art_no\’).val()).