How to see server JSON data, as I am getting a JSON format error

How to see server JSON data, as I am getting a JSON format error

DenonthDenonth Posts: 76Questions: 0Answers: 0
edited June 2012 in General
Hi all,

I need to see my JSON data from server as I am getting a message box error that my json format is not right. I would like to see it so I can change where I made an mistake.

Thank you

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Use Firebug or Webkit's Inspector. Firebug tutorial: www.youtube.com/watch?v=2xxfvuZFHsM

    Allan
  • DenonthDenonth Posts: 76Questions: 0Answers: 0
    edited June 2012
    Thanks for your fast respond. I am not even getting any json data? Is that possible. My request is sent but it keeps receiving data, that little busy circle keeps spinning. Any idea?

    After some time I did get response and it is: Not unique table/alias: 'jphit'

    What would be result of this error? I keep trying to remove this problem for days
  • DenonthDenonth Posts: 76Questions: 0Answers: 0
    @allan Am I allowed to have more than one table in the query? My tables are all in the same database

    Can someone please help me to get this to work. As I am a big fan of this script
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Can you give us a link to the page please?
  • DenonthDenonth Posts: 76Questions: 0Answers: 0
    edited June 2012
    I am testing it on localhost. I will put code inside so you can see.

    This is my table
    [code]



    Time
    Hit value
    Progressive
    Time
    Hit value
    Progressive
    Progressive






    [/code]

    This was the table that was working normally and representing my data normally when I was using only one table in my query.

    Now I have a bit complex query. I try to put it as simple as I can so you can see what I am doing wrong.
    This is a Allan's php code that I have changed to get my data, I'll put just part of the code.

    [code]
    $aColumns=array(FROM_UNIXTIME(a.timestamp)','a.ID','b.name','a.METER_ID','c.LevelName','d.SM_POS', 'a.HIT' );

    /* Indexed column (used for fast and accurate table cardinality) */
    $sIndexColumn = "ID"; //when I put a.ID I am getting the same error

    /* DB table to use */
    $sTable = "a,b,c,d,e";

    $sWhere = "a.ID=b.ID AND a.METER_ID=c.id
    AND b.MACHINE_ID=a.MACHINE_ID
    AND d.co_id=e.id";

    [/code]

    This is one example from my head. If I am making this work with my own database I would give you real query but this is from a company that I work for so they have strict policy.

    One more thing to say. When I run my query in mysql it gives me data that I need to see. So in mysql is working and here it doesn't. I keep getting errors in aserchable variables and so on.

    Can someone see if I am making queries in the right place? maybe my query is not where it should be
  • DenonthDenonth Posts: 76Questions: 0Answers: 0
    and I forgot to put initialization
    [code]
    $(document).ready(function() {
    $('#table_jphit').dataTable( {
    "bProcessing": true,
    "bServerSide": true,
    "sScrollY": "350px",
    "bDeferRender": true,
    "sAjaxSource": "table.php"
    } );
    } );
    [/code]
  • DenonthDenonth Posts: 76Questions: 0Answers: 0
    Any idea guys?
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    I'm afraid not from that. We would need to see a working example to be able to offer much help I think.

    Allan
  • DenonthDenonth Posts: 76Questions: 0Answers: 0
    edited June 2012
    But have I put all the query values in the right place? Like where part should really go there in the [code]$sWhere[/code] and so on. I am thinking that I didn't put part of my queries in the right php variables. What do you think from what you see?
  • DenonthDenonth Posts: 76Questions: 0Answers: 0
    this are the params that I ma getting in the firebug:

    [code]
    _ 1339148570962
    bRegex false
    bRegex_0 false
    bRegex_1 false
    bRegex_2 false
    bRegex_3 false
    bRegex_4 false
    bRegex_5 false
    bRegex_6 false
    bSearchable_0 true
    bSearchable_1 true
    bSearchable_2 true
    bSearchable_3 true
    bSearchable_4 true
    bSearchable_5 true
    bSearchable_6 true
    bSortable_0 true
    bSortable_1 true
    bSortable_2 true
    bSortable_3 true
    bSortable_4 true
    bSortable_5 true
    bSortable_6 true
    iColumns 7
    iDisplayLength 10
    iDisplayStart 0
    iSortCol_0 0
    iSortingCols 1
    mDataProp_0 0
    mDataProp_1 1
    mDataProp_2 2
    mDataProp_3 3
    mDataProp_4 4
    mDataProp_5 5
    mDataProp_6 6
    sColumns
    sEcho 1
    sSearch
    sSearch_0
    sSearch_1
    sSearch_2
    sSearch_3
    sSearch_4
    sSearch_5
    sSearch_6
    sSortDir_0 asc
    [/code]
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    I looks okay form what information is above. However, I'd suggest the error is likely that there is an SQL syntax error. I'd suggest echoing out the SQL query that is built and seeing what is wrong with that.
  • DenonthDenonth Posts: 76Questions: 0Answers: 0
    yes I was just looking in that. So I made a little test just to determine which part is wrong. Error for now is occurring when I put your column array more then one table from which column you need to show then error is occurring. For example if you put in your array a.id and only that , your table will be filled correctly. But when you but a.id, b.id then you have a error. Have you tried that? Try this multiple columns from more then one table in your column array and tell me what you get. Is there any special form to write that down?
This discussion has been closed.