getjson

JSON string to JS object

自作多情 提交于 2019-12-17 07:15:57
问题 I am using a JS object to create graphs with Google visualization. I am trying to design the data source. At first, I created a JS object client-side. var JSONObject = { cols: [{id: 'date', label: 'Date', type: 'date'}, {id: 'soldpencils', label: 'Sold Pencils', type: 'number'}, {id: 'soldpens', label: 'Sold Pens', type: 'number'}], rows: [{c:[{v: new Date(2008,1,1),f:'2/1/2008'},{v: 30000}, {v: 40645}]}, {c:[{v: new Date(2008,1,2),f:'2/2/2008'},{v: 14045}, {v: 20374}]}, {c:[{v: new Date(2008

Jquery getJSON populate select menu question

会有一股神秘感。 提交于 2019-12-17 06:36:22
问题 I am populating a select menu with getJSON. I am wondering if there's a way that I can use jQuery's .each function to bring in these values? Surely there must be an easier way to accomplish this...maybe? PHP file: <?php $queryMonth = "SELECT monthID, month FROM months"; $result = $db->query($queryMonth); while($rowMonth = $db->fetch_assoc($result)) : $data[] = $rowMonth; endwhile; echo json_encode($data); ?> The jQuery: $.getJSON('selectMenus.php', function(data){ $("select.month").append("

JSON Not grabbed by $.getJSON

China☆狼群 提交于 2019-12-14 03:25:34
问题 Final solution: There was something wrong with the formatting of my .json file deeper down than the snippet I included in the question. Everything is working now. Big thanks to everyone in the comments and I'm marking @TWLATL's answer as correct because it's a nicely formatted function solution I can use in projects later. I'm trying to access my data.json file from script.js (both in the root directory) and it doesn't seem to be running at all. Before I put in error handling, I was getting

Android Phonegap application can't connect to internet

天大地大妈咪最大 提交于 2019-12-13 16:41:52
问题 I made a simple android application in phone gap,jQuery mobile, HTML5 with a simple getJSON data encoding . The application working well in Browser . But not in android . When googled I found that android cant connect to internet . So that I added the following <uses-permission android:name="android.permission.INTERNET" /> But Still my application doesn't getting jSON data .. In browser its working well my js file looks like function getMovies(){ var serviceURL = "http://myserver.com/"; alert

JQuery punctuation for spanish (ó, í, etc.) not working in IE8

浪子不回头ぞ 提交于 2019-12-13 16:21:53
问题 Im working with jquery and ASP, and have an SQL database from which I get, using the function $.getJSON(), some descriptions in spanish with "acentos" and "tildes" (á, é, í, ó, ú, ñ, etc.). With Chrome 4 and FireFox is working fine. The problem is with IE8: with some particular query, it hangs without getting the result back. If I replace all "ó" with "o" using IE, the same resultset works perfect, so I know the problem is with the "acentos" (ó). Im setting the ajax call with this code: $

Double request mysql/php for ajax

倾然丶 夕夏残阳落幕 提交于 2019-12-13 08:06:39
问题 1 : I know my db is pretty mess-up, but I DON'T HAVE ACCES. I know they are crappy builded. 2 : There is my database and my 2 tables: http://www.freeimagehosting.net/iu741 3 : I got 3 dynamics lists, the first 2 are ok, but I got problem at my Third one. 4 : My explode are well done of this field (22312,123,2145,1233) then i take those results and i send them by json_encode to my JS, and my JS send those resylts to my select/options. My result are: http://www.freeimagehosting.net/gltie 5: So

$getJSON .fail not firing

不打扰是莪最后的温柔 提交于 2019-12-13 07:39:46
问题 Can't alert $getJSON .fail: this.flickrPics = ko.observableArray(); ko.computed(function() { $.getJSON( 'https://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?', { tags : data.name, format : 'json' }) .done(function(response) { for (var i = 0; i < 10; i++) { self.flickrPics.push(response.items[i].media.m); } }) .fail(function(error) { alert(error + 'error'); // $('.pics-box h2').text("sorry, pictures cant be loaded at the moment"); }); }, this); Everything works perfect except

Cannot parse JSON data from MySQL Database

我与影子孤独终老i 提交于 2019-12-13 06:05:29
问题 I am developing an android application that requires me to connect to a mysql database and retrieve information from it. I am using a php script to connect to the server and query it and then output the results in json format: if(!mysql_connect($mysql_host,$mysql_user,$mysql_pass) || !mysql_select_db($mysql_db)){ die($conn_error); } $q=mysql_query("SELECT * FROM food"); while($e=mysql_fetch_assoc($q)) $output[]=$e; print(json_encode($output)); mysql_close(); ?> Here is my java code that uses

populate listview with json parser

橙三吉。 提交于 2019-12-13 04:53:31
问题 i want to populate listview with json parser. but i have following error: 12-12 22:49:39.812: ERROR/JSON Parser(1254): Error parsing data org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject JSONParse: public class JSONParser { static InputStream is = null; static JSONObject jObj = null; static String json = ""; // constructor public JSONParser() { } public JSONObject getJSONFromUrl(String url) { // Making HTTP request try { // defaultHttpClient

MVC3 jQuery getJSON doesnt issue a call

a 夏天 提交于 2019-12-13 04:12:17
问题 I am trying to make ajax work using getJSON() call. When I navigate to /Home/GetWeather, I get Json data back in the browser. However the jQuery call is not working. Any ideas? When I put a breakpoint on alert("Hello"), it never hit. In firebug I dont see any ajax call. Any ideas? $(document).ready(function() { $("#Button1").click(function() { $.getJSON("/Home/GetWeather", null, function(data) { alert("Hello"); }); }); });​ Controller code public class HomeController : Controller { // // GET: