DataTable and jQuery validation

DataTable and jQuery validation

ZangueiZanguei Posts: 3Questions: 0Answers: 0
edited May 2011 in General
hello all.
I used DataTable in my page.
Then add jQuery validation script tag to it.
[code][/code]
After refresh the page, DataTable alert "DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.".
I need to use both. Please help me.
Thank you for your solutions.

Replies

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    http://datatables.net/faqs#json :-)

    Allan
  • ZangueiZanguei Posts: 3Questions: 0Answers: 0
    Thanks allan.
    I used JSONLint for validation my json code. Result was "Valid JSON".
    but DataTable show warning.
    [code]
    {
    "sEcho": "0",
    "iTotalRecords": "4",
    "iTotalDisplayRecords": "4",
    "aaData": [
    [
    "",
    "en_US",
    "First from admin panel",
    "First from admin panel. \r\nFirst from admin panel",
    "2010-05-02",
    "1",
    "admin"
    ],
    [
    "",
    "en_US",
    "1th - Our site is a LMS project for you.",
    "Adobe Business Catalyst is a hosted application that replaces traditional desktop tools with one, central platform for web designers. The application works hand-in-hand with Dreamweaver, and lets you build everything from basic data-driven websites to pow",
    "2010-03-18",
    "1",
    "admin"
    ],
    [
    "",
    "en_US",
    "Finding everything with the Awesome Bar",
    "We like to call Firefox's Location bar, the \"Awesome Bar\" because when you start to type the name or address of a website you've been to before, it finds it for you in an instant. And the more you use it, the better it gets. To learn more Awesome Bar ",
    "2010-04-06",
    "1",
    "admin"
    ],
    [
    "",
    "en_US",
    "Staying safe",
    "Firefox has a color-coded system that makes it easy to check on suspicious sites and avoid Web forgeries.\r\nFirefox's Private Browsing feature allows you to browse the Internet without saving any information to your computer about which sites and pages y",
    "2010-04-19",
    "1",
    "admin"
    ]
    ]
    }
    [/code]
    please help me.
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    sEcho should never be '0'. It should be an echo of the value that is sent to the server by DataTables.

    Allan
  • sniperjsniperj Posts: 1Questions: 0Answers: 0
    I am having the same issue when I use both jquery.validate and datatables. Could it be a situation where both include files are using the similar variables?
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Are you using the very latest version of jQuery, DataTables and the validation plug-in? There was a conflict between jQuery 1.5 (or 1.6 - can't quite remember) and the validation plug-in for Ajax.

    Allan
This discussion has been closed.