‏إظهار الرسائل ذات التسميات values. إظهار كافة الرسائل
‏إظهار الرسائل ذات التسميات values. إظهار كافة الرسائل

الأحد، 5 يناير 2014

Sunlight Foundation json data - how to extract the values

up vote 0 down vote favorite

I'm experimenting with Sunlight Foundation Capitol words API and Webpy.

I'm able to retrieve the data from sunlight and store the results in a Webpy variable ($data) which is pass to the template.

It is possible to pass a templetor (webpy template system) variable to a Javascript and extract the results values?

I found a couple of JSON lectures and videos which I tried but so far can make it happen. I think that I might need to write the data into a JSON file before I could use it but at the same time I question myself because the results from sunlight are already formatted as JSON.

Here are two objects from the results: It would be a great help if some one could suggest how to manage this JSON with a Javascript or provide some options. Thanks in advance

{ "num_found": 78682, "results": [ { "speaker_state": "OH", "speaker_first": "Tim", "congress": 110, "title": "30-SOMETHING WORKING GROUP", "origin_url": "http://origin.www.gpo.gov/fdsys/pkg/CREC-2007-03-26/html/CREC-2007-03-26-pt1-PgH3071-2.htm", "number": 52, "order": 13, "volume": 153, "chamber": "House", "session": 1, "id": "CREC-2007-03-26-pt1-PgH3071-2.chunk13", "speaking": [ "Civil war." ], "capitolwords_url": "http://capitolwords.org/date/2007/03/26/H3071-2_30-something-working-group/", "speaker_party": "D", "date": "2007-03-26", "bills": null, "bioguide_id": "R000577", "pages": "H3071-H3078", "speaker_last": "Ryan", "speaker_raw": "mr. ryan of ohio" }, { "speaker_state": null, "speaker_first": null, "congress": 110, "title": "[Filed on January 4, 2007]", "origin_url": "http://origin.www.gpo.gov/fdsys/pkg/CREC-2007-01-05/html/CREC-2007-01-05-pt1-PgH110.htm", "number": 2, "order": 57, "volume": 153, "chamber": "House", "session": 1, "id": "CREC-2007-01-05-pt1-PgH110.chunk57", "speaking": [ "Service and the Naval Transport Service) during World War II; " ], "capitolwords_url": "http://capitolwords.org/date/2007/01/05/H110_filed-on-january-4-2007/", "speaker_party": null, "date": "2007-01-05", "bills": null, "bioguide_id": null, "pages": "H110-H123", "speaker_last": null, "speaker_raw": "recorder" }]

}


View the original article here

how to check input boxes according to values

You can iterate through the array of values, then check each input based on the product ID.

list.forEach(function(item) { $('#product_'+ item).prop('checked', true);});

.forEach() documentation

.prop() documentation


View the original article here

الخميس، 26 ديسمبر 2013

Populate values from one table

I am trying to populate an empty table(t) from another table(t2) based on a flag field being set. He is my attempt below and the table data.

UPDATE 2014PriceSheetIssues AS tJOIN TransSalesAvebyType2013Combined AS t2 SET t.`Tran_Type`=t2.`Tran_Type` WHERE t.`rflag`='1';Tran_Type; RetailAvePrice; WholesaleAvePrice; Rflag; Wflag;125C 992 650 1 \n2004R 1500 \N 1 \N4EAT 1480 1999 1 1

View the original article here