[eluser]C_O_S[/eluser]
hi everybody
i am getting interesting warning.
i am creating table with js in my view and this table has select boxes.when i click button ,adding new line.there is one select box in this line and options(this selectbox) are coming db but how?
one js file that creates this table.(external file)
i call one ajax request and this reguest is going to call one function in controller.This controller get data from one model.Model return data and controller is writing this data(php echo)and ajax request get this writen data and write view.
loadedview->click->creating ajx request and newline(selectbox in thisline)->ajax request->function(controller)->function(model)->DATA is returning->controller->writing DATA with echo in controller.->ajax request is getting this DATA->writing options where selectbox.
Code:
function loadAuctionListRate(){
$query=$this->db->get('auction_rate');
foreach($query->result() as $row){
$option.="<option value=\"".$row->id."\">".$row->rate."</option>";
}
return $option;
}
this is my model function
appending SELECTbox ->>>>>>>an external js file
Code:
var rate=new_job.insertCell(6);
rate.className="rate";
rate.width="50px";
rate.align="center";
var select_rate=document.createElement('select');
select_rate.name=rate.className+group_id+line_number;
$(document).ready(function(){
$.ajax({
type: "POST",
url: "controller(not important)",
success: function(answer) {
select_rate[removed]=answer;
},
dataType: "html"
});
});
rate.appendChild(select_rate);
controller
Code:
function AuctionListRateAjax(){
$this->load->model('muser_profile','',TRUE);
$options=$this->muser_profile->loadAuctionListRate();
echo $options;
}
and
A PHP Error was encountered Severity: Notice Message: Undefined variable: option Filename: models/muser_profile.php Line Number: 30
how can i solve this? PLEASE HELP ME=)