[eluser]123wesweat[/eluser]
Hi,
Finally got an ajax div working with a couple of search filters, but now i am stuck with the pagination??
First off, i don't know if i am using the ajax the right way. But here's my setup
template.php with the jquery ajax javascript and a simple php if statement to check if there is a table of search results otherwise just show a overview.
This is the javascript part
Code:
function generate_query(){
frm=document.forms["filterjobs"];
qry="runquery=1";
for(z=0;z<frm.elements.length;z++){
if(frm.elements[z].type=="select-one" && frm.elements[z].options.selectedIndex>0){
qry += "&" + frm.elements[z].name + "=" + frm.elements[z].options[frm.elements[z].options.selectedIndex].value;
}
}
//ajax querystring
alert(qry);
$.ajax({
type: "POST",
url: "jobs/ajaxSearchJobs",
data: qry,
beforeSend: function() { $('#wait').show(); },
complete: function() { $('#wait').hide(); },
success: function(msg){
alert( "Data Saved: " + msg );
$('#searchResult').html(msg); // Fill the search results box
}
});
//end search result
}
model simply retrieves the data with multiple %like%
controller jobs has this method
Code:
function ajaxSearchJobs() {
$runquery = isset($_POST['runquery']) ? $_POST['runquery'] :'';
$searchItemA= isset($_POST['searchItemA']) ? $_POST['searchItemA'] :'';
$searchItemB= isset($_POST['searchItemB']) ? $_POST['searchItemB'] :'';
$searchItemC= isset($_POST['searchItemC']) ? $_POST['searchItemC'] :'';
$searchItemD= isset($_POST['searchItemD']) ? $_POST['searchItemD'] :'';
if($runquery==1) {
//search the DB
$data['jobsfound'] = $this->jobs_model->filter_jobs($runquery, $searchItemA,$searchItemB,$searchItemC,$searchItemD);
$data['tableResult'] = $this->load->view('vacatures/view_filter_results', $data, TRUE);
//for ajax we just need to echo???
echo $data['tableResult'];
//$this->load->view('jobs/template', $data);//<-we don't need this
} else {
//not direct access
echo "No direct search";
}
}
But now i need to get the pagination to work in template.php?? As i am not using
Code:
$this->load->view('jobs/template_jobs', $data)
i am confused how i can get
Code:
$this->pagination->initialize($config);
to work in template.php
Any tips, suggestions