I have a view, that using jquery posts some information to the controller. the controller then runs some logic using the post information and returns the result to a div in my view.
my view syntax is:
$.post("get_link_load_options", { varlatitude: latitude, varlongitude: longitude }).done(function(data) {
$('#results').html(result);
});
My Controller syntax is:
function get_link_load_options(){
$this->load->model('Sales_model');
if (isset($_POST['data'])){
$q = strtolower($_POST['data']);
$data['result'] = $this->Sales_model->get_link_load_options($q);
$this->load->view('sales\link_order_options',$data);
}
}
Currently, with this syntax the div is populated with the value of the variable latitude and is duplicated.
How can I show the contents of the view link_order_options and also, how do I access each variable in the controller so I can perform logic with it. currently $q fetched the data variable/array.
how do I store each of latitude and longitude as a PHP variable in my controller?
Thanks as always.
Input Classto retrieve the post data. Check answer below.datato the controller, onlyvarlatitudeandvarlongtitude. Which means in the controller you'll find them by accessing$_POST['varlatitude']and$_POST['varlongtitude'].