0

I Try tutorial from http://www.jeasyui.com/tutorial/datagrid/datagrid24.php

I create this function in mycontroller..

function doSearch(){
$('#tt').datagrid('load',{
itemid: $('#itemid').val(),
productid: $('#productid').val()
});
}

I get error message like this..

Parse error: parse error, expecting T_VARIABLE' or'$'' in C:\xampp\htdocs\ci_jquery\application\controllers\crud.php on line 55

I dont know, how to create that function in controller codeigniter. Thanks For The Reply..

4

1 回答 1

1

Your problem is that the code which you've posted is not PHP code, it's Javascript code (more specifically, it belongs to the jQuery framework). It does not need to live in a controller, but instead should be added to the view, where your HTML content is.

You first need to load a view file, and then add the code above into it.

$this->load->view('myview');

You would then have to add the Javascript code which you've posted into your view file (in the example I've provided, that would be in application/views/myview.php. Make sure to also include the jQuery library in your template!

You can read more on views here: http://ellislab.com/codeigniter/user-guide/general/views.html

于 2013-10-11T10:24:37.300 回答