0

I am using datatables with Codeigniter library (https://github[dot]com/IgnitedDatatables) and I have several problems.

Problem @firebug:

"NetworkError: 500 Internal Server Error - http://www[dot]rodocomp[dot]si/shopmanager/server/datatables?callback=jQuery152008148431712533122_1302880482637"

I assume that error is because of ?callback=jQuery152008148431712533122_1302880482637, right?

Another error @firebug:

POST http://www[dot]rodocomp[dot]si/shopmanager/server/datata...llback=jQuery152008148431712533122_1302880482637 POST http://www.rodocomp.si/shopmanager/server/datatables?callback=jQuery152008148431712533122_1302880482637 500 Internal Server Error 252ms

Answer:

An Error Was Encountered Unable to load the requested file: ajax.php

What is ajax.php file ??

This is my JavaScript code:

$('#example').dataTable({
      'bProcessing'    : true,
      'bServerSide'    : true,
      'sAjaxSource'    : '<?php echo base_url(); ?>server/datatables',
      'sPaginationType': 'full_numbers',
      'bAutoWidth'     : false,
      'aoColumns'      : [ 
        { 'sName': 'edit', 'bSortable': false },
        { 'sName': 'delete', 'bSortable': false },
        { 'sName': 'products.products_id', 'bVisible': false },
        { 'sName': 'products.products_price' }
      ],
      'fnServerData'   : function(sSource, aoData, fnCallback)
      {
        $.ajax({
          'dataType': 'json',
          'type'    : 'POST',
          'url'     : sSource,
          'data'    : aoData,
          'success' : fnCallback
        }); 
      }, 
});

What am I doing wrong?

Regards, Mario

1 Answer 1

1

You're getting that error, because you're not setting the sAjaxSource correctly. First, for the url you've set there, it seems that you've .htaccess removing the need for index.php (if not, this is a error). Maybe you've created a SERVER dir on the root, and that's ok!

Anyway, you can try to place a controller that returns a JSON this way (just to test): "sAjaxSource": "index.php/yourController/yourMethod"

If you're using codeigniter, keep the CI way, on doing things! That's the best way to get this to work.

Hope this helps!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.