Jquery
jQuery(document).ready(function() {
var dataString = "tableName=campaign_master";
$.ajax
(
{
dataType: "json",type: "POST", url: "getCampaign.php", data: dataString,
success:
function(data)
{
console.log(data);
$.each(
data,
function(intIndex, objValue ){
$('#campaignid').append(
$( "<option id="+objValue+">" + objValue + "</option>" )
);
}
);
},
error:
function (XMLHttpRequest, textStatus, errorThrown)
{
}
}
)
});
php
echo json_encode(databasecall returning array);
databasecall
$recordsArray = array();
$qry = "Select auery" ;
$recordsArray = $this->executeQuery($qry);
foreach($recordsArray as $record)
{
$idArray[] = $record['cm_id'];
}
return $idArray; //returning array
jQuery(document).ready(function() {
var dataString = "tableName=campaign_master";
$.ajax
(
{
dataType: "json",type: "POST", url: "getCampaign.php", data: dataString,
success:
function(data)
{
console.log(data);
$.each(
data,
function(intIndex, objValue ){
$('#campaignid').append(
$( "<option id="+objValue+">" + objValue + "</option>" )
);
}
);
},
error:
function (XMLHttpRequest, textStatus, errorThrown)
{
}
}
)
});
php
echo json_encode(databasecall returning array);
databasecall
$recordsArray = array();
$qry = "Select auery" ;
$recordsArray = $this->executeQuery($qry);
foreach($recordsArray as $record)
{
$idArray[] = $record['cm_id'];
}
return $idArray; //returning array