0

I'm using the jquery-datatables-editable plugin at https://code.google.com/p/jquery-datatables-editable/wiki/EditCell#Client-side_configuration with CI.I have:

<script language="javascript" type="text/javascript">
    $(document).ready(function () {
       $('#myDataTable').dataTable().makeEditable({
           sUpdateURL: "/js/jquery-databatables-editable/AjaxUpdate_1.php/index"
       });
    });
 </script>

on the client side page. I want to be able to post to a class a CI library class/function on the server side, but the above does not seem to work. Is there a way to do this?

bipen
  • 36,319
  • 9
  • 49
  • 62
user1592380
  • 34,265
  • 92
  • 284
  • 515
  • is this inside php page.. or you have seperate js file ?? – bipen Jul 11 '13 at 18:25
  • The above script is on the client page which is a CI view called mlist.php . The setup is at https://code.google.com/p/jquery-datatables-editable/wiki/HTMLSource – user1592380 Jul 11 '13 at 18:41
  • see my answer [here](http://stackoverflow.com/questions/15584776/code-igniter-get-ajax-value-from-view-to-controller/15700016#15700016) – Khawer Zeshan Jul 11 '13 at 20:27

1 Answers1

2

That's depends on the configuration you have.

Mostly common, if you are using the default setup:

In you Javascript file or view (if inline)

<script language="javascript" type="text/javascript">
    $(document).ready(function () {
       $('#myDataTable').dataTable().makeEditable({
           sUpdateURL: "/index.php/your_controller/function_name"
       });
    });
 </script>

In your routes.php

$route["function_name"] = "your_controller/function_name/";

Lastly, you need to create a function in your controller and output the expected format:

function function_name(){
    echo json_encode('whatever you need to return');
}

Hope it helps!

simongus
  • 440
  • 2
  • 6