Retreiving json data from remote server

Retreiving json data from remote server

adobewebsadobewebs Posts: 2Questions: 0Answers: 0
edited June 2012 in DataTables 1.9
Hi,

I am trying to use DataTables to create a web page that can insert the following data below:

The call is made via https://sendgrid.com/api/stats.get.json?api_user=youremail@domain.com&api_key=secureSecret&days=30

Below is the a small portion of the data returned. How would you code this? Also is there a way to make sure the raw data is being returned as in some dump command before you actually code the table structure?

[{"category": "sample.com", "delivered": 1, "unsubscribes": 0, "invalid_email": 0, "bounces": 0, "repeat_unsubscribes": 0, "unique_clicks": 0, "blocked": 0, "spam_drop": 0, "repeat_bounces": 0, "repeat_spamreports": 0, "date": "2012-05-06", "requests": 1, "spamreports": 0, "clicks": 0, "opens": 0, "unique_opens": 0},{"category": "sample.com", "delivered": 4, "unsubscribes": 0, "invalid_email": 0, "bounces": 0, "repeat_unsubscribes": 0, "unique_clicks": 0, "blocked": 0, "spam_drop": 0, "repeat_bounces": 0, "repeat_spamreports": 0, "date": "2012-05-07", "requests": 4, "spamreports": 0, "clicks": 0, "opens": 0, "unique_opens": 0},{"category": "sample.com", "delivered": 1, "unsubscribes": 0, "invalid_email": 0, "bounces": 0, "repeat_unsubscribes": 0, "unique_clicks": 1, "blocked": 0, "spam_drop": 0, "repeat_bounces": 0, "repeat_spamreports": 0, "date": "2012-05-08", "requests": 1, "spamreports": 0, "clicks": 1, "opens": 47, "unique_opens": 0},

Thanks,
Jim

Replies

  • allanallan Posts: 63,397Questions: 1Answers: 10,451 Site admin
    You need to use JSONP to get data from a remote server, or something like YQL.

    Allan
  • adobewebsadobewebs Posts: 2Questions: 0Answers: 0
    Hi Allan,

    I guess the question I am asking is can your software do this rather than me building my own solution using javascript or jquery? If yours can please show me a link of an example you have already built.

    Thanks,
    Jim
    P.S. I have the whole thing built using PHP but it is not AJAX so I was just trying to see how your software could do the same thing.
  • allanallan Posts: 63,397Questions: 1Answers: 10,451 Site admin
    edited June 2012
    There is an example of JSONP on the examples page ( http://datatables.net/examples/ ): http://datatables.net/release-datatables/examples/server_side/jsonp.html :-)

    Allan
This discussion has been closed.