Search Results

Search found 326 results on 14 pages for 'getjson'.

Page 1/14 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • JQuery getJSON Callback Returning Null Data

    - by user338828
    I have a getJSON call that is called back correctly, but the data variable is null. The python code posted below is executed by the getJSON call to the demandURL. Any ideas? javascript: var demandURL = "/demand/washington/"; $.getJSON(demandURL, function(data) { console.log(data); }); python: data = {"demand_count":"one"} json = simplejson.dumps(data) return HttpResponse(json, mimetype="application/json")

    Read the article

  • Variable scoping and the jQuery.getJSON() method

    - by jerome
    The jQuery.getJSON() method seems to ignore the normal rules of scoping within JavaScript. Given code such as this... someObject = { someMethod: function(){ var foo; $.getJSON('http://www.somewhere.com/some_resource', function(data){ foo = data.bar; }); alert(foo); // undefined } } someObject.someMethod(); Is there a best practice for accessing the value of the variable outside of the getJSON scope?

    Read the article

  • setting jQuery .data() within .getJSON callback

    - by hackmaster.a
    I'm doing a couple of .getJSON calls and if any one of them succeeds, I'm trying to set a bool to true so I can then do some other stuff elsewhere on the page. I was trying to use jquery's .data() function, but I don't seem able to set it from inside the .getJSON callback. for example: $('#citations_button').data('citations', false); $.getJSON(apaurl, function(data) { $('#apacite').html("<td class=\"bibInfoLabel\">APA Citation</td><td class=\"bibInfoData\">"+data+"</td>"); $('#citations_button').data('citations', true); }, "html"); // other .getJSONs look like above... console.log("citations? "+$('#citations_button').data('citations')); prints false, even when I know the data came through. I thought this would work since .data() uses the cache to store the key/value pair. how can i flag successes?? appreciate any assistance!!

    Read the article

  • getjson jquery parsing an array

    - by Ozaki
    TLDR: Want to get each heading from an array and insert it into a div without knowing what is inside the div using Jquery - getJSON. I have JSON array lets say: jsonfeed({ "items": [ { "d":{"title":"034324324-22344231-10"} }, { "d"{"title":"23423404-3423422-10"} }, { "d"{"title":"0234234324-32432422-10"} }, { "d"{"title":"0234234324-223534534-10"} ] }) And I want to parse it as for each "title" to insert it into a div. Trying along the lines of $.getJSON(url, function(data){ $.each(data.items, function(i,item){ $('#testfield').html('<p>' + item.d.title + '</p>'); }); }); to no avail. I am using Getjson in other places but in cases where I know what request I am making. e.g: $('#livetime').html(data.Time); Which is all working perfectly fine but in this case I need to get the details out of the array without knowing what is inside the array I'm sure there is something simple that I'm missing here or doing wrong ^^.

    Read the article

  • my getJSON code doesn't work in jquery 1.4.2

    - by Nikolius
    This is my first question on stackoverflow. I just wonder why my getJSON code doesn't work with jQuery 1.4.2, it worked smoothly with jQuery 1.3.2 though So here is my code $(document).ready(function(){ $('td.hps_ajax a').click(function() { id = this.id.replace(/.*hps_ajax/,''); if(confirm('Anda yakin mau menghapus record ini?')) $.getJSON('../admin/media_admin/ajaxHapus/'+id, remove_row); return false; }); }) function remove_row(data) { if(data.sukses == '1') { $('td.hps_ajax a#hps_ajax'+data.id).closest('tr').fadeOut('slow',function() { $(this).remove(); }); } else { alert('Gagal menghapus File.'); } } The getJSON link is a CodeIgniter App Link. Anyone know why this doesn't work anymore?

    Read the article

  • Jquery getJSON Not Working Cross Site

    - by CJ
    I have a piece of javascript that grabs JSON data. When executed locally everything seems to work fine. However, when I try accessing it from a different site, it doesn't work. Here's the script. $(function(){ var aT = new AjaxTest(); aT.getJson(); }); var AjaxTest = function() { this.ajaxUrl = "http://mydeveloperpage.com/sandbox/ajax_json_test/client_reciever.php"; this.getJson = function(){ $.getJSON(this.ajaxUrl, function(data){ $.each(data, function(i, piece){ alert(piece); }); }); } } You can find a copy of the exact same file at "http://mydeveloperpage.com/sandbox/ajax_json_test/". Any help would be greatly appreciated. Thanks!

    Read the article

  • getJSON triggered from a button inside a form

    - by nav
    Hi, I'm having trouble understanding why I have to place the button triggering the getJSON method outside of the form for the request to work. If the button is placed within the form then the getJSON method returns no results. The code bascially makes a XHR request on clicking the Submit button, based on the value selected. I have replicated the issue here: http://jsfiddle.net/z6caj/ Many Thanks,

    Read the article

  • getJSON not working if the mvc model view controller has a parameter

    - by Paul
    I'm having an issue with a callback. I'm not even getting an error in Firebug. If I alert before and after the getjson call both alerts show but the getjson call doesn't fire. public ActionResult TestPage() { return View(); } public ActionResult LoadMapLonLats(int mapId) { //some code return Json(_myMaps); } $("#Search").click(function() { $.getJSON("LoadMapLonLats", { mapId: 73 }, loadDbMap); }); function loadDbMap(maps) { alert('m'); $.each(maps, function(i) { alert(maps[i]); }); } As long as I leave TestPage without a parameter is works. If I add a parameter to TestPage(int id) then the call back to LoadMapLonLats doesn't work. Seems odd. Of course TestPage is the page I'm loading so I need to do some work here before rendering the page. Not sure why adding a parameter to the view would break the callback to another function. //this breaks he callback to LoadMapLonLats public ActionResult TestPage(int id) { return View(); } Any ideas? Seems like this may be related, if not sorry I can post a new thread.

    Read the article

  • Problems with jQuery load and getJSON only when using Chrome

    - by leftend
    I'm having an issue with two jQuery calls. The first is a "load" that retrieves HTML and displays it on the page (it does include some Javascript and CSS in the code that is returned). The second is a "getJSON" that returns JSON - the JSON returned is valid. Everything works fine in every other browser I've tried - except Chrome for either Windows or Mac. The page in question is here: http://urbanistguide.com/category/Contemporary.aspx When you click on a Restaurant name in IE/FF, you should see that item expand with more info - and a map displayed to the right. However, if you do this in Chrome all you get is the JSON data printed to the screen. The first problem spot is when the "load" function is called here: var fulllisting = top.find(".listingfull"); fulllisting.load(href2, function() { fulllisting.append("<div style=\"width:99%;margin-top:10px;text-align:right;\"><a href=\"#\" class=\"" + obj.attr("id") + "\">X</a>"); itemId = fulllisting.find("a.listinglink").attr("id"); ... In the above code, the callback function doesn't seem to get invoked. The second problem spot is when the "getJSON" function is called: $.getJSON(href, function(data) { if (data.error.length > 0) { //display error message } else { ... } In this case - it just seems to follow the link instead of performing the callback... and yes, I am doing a "return false;" at the end of all of this to prevent the link from executing. All of the rest of the code is inline on that page if you want to view the source code. Any ideas?? Thanks

    Read the article

  • ASP.NET MVC Pass mutiple params from getJson to controller

    - by andyJ
    Hi, I am making a call to a controller action in javascript using the getJson method. I need to pass two parameters to my action method on the controller, but I am struggling to do so. I do not fully understand the routing tables and not sure if this is what I need to use to get this working. Please see example below of what I am trying to do. var action = "<%=Url.Content('~/Postcode/GetAddressResults/')%>" + $get("Premise").value + "/" + $get("SearchPostcode").value $.getJSON(action, null, function(data) { $("#AddressDropDown").fillSelect(data); }); This is my route which I don't understand how to make use of... routes.MapRoute( "postcode", "Postcode/GetAddressResults/{premise}/{postcode}", new { controller = "Motor", action = "GetAddressResults", premise = "", postcode = "" });

    Read the article

  • jQuery getJson returning null

    - by Adam
    I'm trying to use this api that lets you reference an exact text, but the getJson does not seem to be working, it's just returning null. $.getJSON('http://api.biblia.com/v1/bible/content/KJV.json?key=MYAPIKEY=John+3:16-18&style=bibleTextOnly', function(data) { alert(data); }); I just took the key out, i've been testing it with my real api key, and it works fine when i just visit the url. is there anything else i need to do to make it work? This is what you get from the url when you have an api key in the url: {"text":"For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life. For God sent not his Son into the world to condemn the world; but that the world through him might be saved. He that believeth on him is not condemned: but he that believeth not is condemned already, because he hath not believed in the name of the only begotten Son of God."}

    Read the article

  • Using JQuery getJSON method

    - by nav
    Hi, I am attempting to pase a a JSON data using the JQuery getJSON function. The REST query is: http://query.yahooapis.com/v1/public/yql?q=select%20woeid%20from%20geo.places%20where%20text%20%3D%20%22london%22&format=json&jsoncallback=? The script I'm using to parse 'data' to obtain the WOEID value doesnt seem to work below: $.getJSON("http://query.yahooapis.com/v1/public/yql?"+ "q=select%20woeid%20from%20geo.places%20where%20text%20%3D%20%22"+ "london"+ "%22&format=json&jsoncallback=?", function(data){ console.log("json: " + data); var datatmp = data; if(data.results[0]){ var data = filterData(data.results.place[0]); } } ); Can anyone say what I'm doing wrong? link text

    Read the article

  • getjson and servers

    - by gheil.apl
    Is getJSON only useful for those who control a server? Is there any other alternative for getting data from a file? i tried $.getJSON("good.json", function(data){ out=out+"good.json: "+data + ","; }); where good.json = {"a":"1","b":"2"} and got a result of 'null' for data. These all are valid JSON files, and all give null when used in the above: good.htm assoc.json assoc.js stub.json stub.js test.js test.txt and all get a null result... The above is in an interactive setting at http://jsbin.com/dbJSON/8/edit the output (of null) is to be had by clicking 'output'.

    Read the article

  • Is this a valid jquery getJSON call?

    - by Pandiya Chendur
    I am using jquery getJSON with asp.net mvc controller... I cant able to get it work.... public JsonResult GetMaterials(int currentPage,int pageSize) { var materials = consRepository.FindAllMaterials().AsQueryable(); var results = new PagedList<MaterialsObj>(materials, currentPage-1, pageSize); return Json(results); } and i am calling this with, $.getJSON('Materials/GetMaterials', "{'currentPage':1,'pageSize':5}", function(data) { }); This call doesn't seem to work.... when inspected through firebug i found this, The parameters dictionary contains a null entry for parameter 'currentPage' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.JsonResult GetMaterials(Int32, Int32)' in 'CrMVC.Controllers.MaterialsController'. To make a parameter optional its type should be either a reference type or a Nullable type.<br> Parameter name: parameters

    Read the article

  • jQuery .getJSON() Not Parsing All Objects

    - by Brad
    I'm using jQuery's .getJSON function to parse a set of search results from a Google Search Appliance. The search appliance has an xslt stylesheet that returns the results as JSON data, which I validated with both JSONLint and Curious Concept's JSON Formatter. According to FireBug, the full result set is returned from the XMLHTTPRequest, but I tried dumping the data (with jquery.dump.js) and it only ever parses back the first result. It does successfully get all the Google Search Protocol stuff, but it only ever sees one "R" object (or individual result). Has anybody had a similar problem with jQuery's .getJSON? I know it likes to fail silently if the JSON is not valid, but like I said, I validated the results with several validators and it should be good to go. Edit: Clicking this link will show you the JSON results returned for a search for the word "google": http://bigbird.uww.edu/search?client=json_frontend&proxystylesheet=json_frontend&proxyrefresh=1&output=xml_no_dtd&q=google jQuery only retrieves the first "R" object, even though all "R" objects are siblings.

    Read the article

  • Parsing a complicated array with GetJSON Jquery

    - by Ozaki
    TLDR: Started with this question simplified it after got some of it working and continuing it here. I need to 'GET' the JSON array Format it correctly and for each within the array place it in the corresponding DIV. ?? It works. This is a followup from this question to simplify and continue. I need to some complicated JSON data from an array. With it I need the title and it's value. The reason why I am doing this is because I will know what the array is called but not the data that is being generated inside it. Lets say this new array looks as follows: {"Days": ["Sunday":"10.00", "Monday":"12.00", "Tuesday":"09.00", "Wednesday":"10.00", "Thursday":"02.00", "Friday":"05.00", "Saturday":"08.00"] } I would need it to get Sunday & 10.00 as well as the same for all of the others. My code to parse this at the moment is as follows: $.getJSON(url, function(data){ $.each(data, function(i,item){ $('.testfield').append('<p>' + item + '</p>'); }); }); Without the added times on each date it will parse the data as follows: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday With the times added to the days in the array Firebug no longer recognizes it as a JSON string. So I am guessing I have formatted something wrong here. Also, I need each day & time to be on a new line I thought that $('.testfield').append('<p>' + item + '</p>' + '<br />'); Would have applied each one to a new line but that did not work. How do I get each day or item to be on a new line? How do I get the $getjson to parse the data correctly day and its value, into a div?

    Read the article

  • Jquery getJSON to external PHP page

    - by Pmarcoen
    I've been trying to make an ajax request to an external server. I've learned so far that I need to use getJSON to do this because of security reasons ? Now, I can't seem to make a simple call to an external page. I've tried to simplify it down as much as I can but it's still not working. I have 2 files, test.html & test.php my test.html makes a call like this, to localhost for testing : $.getJSON("http://localhost/OutVoice/services/test.php", function(json){ alert("JSON Data: " + json); }); and I want my test.php to return a simple 'test' : $results = "test"; echo json_encode($results); I'm probably making some incredible rookie mistake but I can't seem to figure it out. Also, if this works, how can I send data to my test.php page, like you would do like test.php?id=15 ? The test.html page is calling the test.php page on localhost, same directory I don't get any errors, just no alert ..

    Read the article

  • sending large data .getJSON or proxy ?

    - by numerical25
    Hey guys. I was told that the only trick to sending data to a external server (i.e x-domain) is to use getJSON. Well my problem is that the data I am sending exceeds the getJSON data limit. I am tracking mouse movements on a screen for analytics. Another option is I could also send a little data at a time. probably every time the mouse moves. but that seems as if it would slow things down. I could setup a proxy server. My question is which would be better? Setting up a proxy server ? or Just sending bits of information via javascript or JQUERY. What do the professionals use (Google and other company's that build mash-ups that send a lot of data to x-domain sites.) I need to know the best practices. Thanx!! Also the data is put into JSON.

    Read the article

  • Jquery getJSON populate select menu question...

    - by Scott
    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("<option value=" + data[0].monthID + ">" + data[0].month + "</option>"); $("select.month").append("<option value=" + data[1].monthID + ">" + data[1].month + "</option>"); $("select.month").append("<option value=" + data[2].monthID + ">" + data[2].month + "</option>"); $("select.month").append("<option value=" + data[3].monthID + ">" + data[3].month + "</option>"); $("select.month").append("<option value=" + data[4].monthID + ">" + data[4].month + "</option>"); $("select.month").append("<option value=" + data[5].monthID + ">" + data[5].month + "</option>"); $("select.month").append("<option value=" + data[6].monthID + ">" + data[6].month + "</option>"); $("select.month").append("<option value=" + data[7].monthID + ">" + data[7].month + "</option>"); $("select.month").append("<option value=" + data[8].monthID + ">" + data[8].month + "</option>"); $("select.month").append("<option value=" + data[9].monthID + ">" + data[9].month + "</option>"); $("select.month").append("<option value=" + data[10].monthID + ">" + data[10].month + "</option>"); $("select.month").append("<option value=" + data[11].monthID + ">" + data[11].month + "</option>"); }); my json output looks like this: [{"monthID":"1","month":"January"},{"monthID":"2","month":"February"},{"monthID":"3","month":"March"},{"monthID":"4","month":"April"},{"monthID":"5","month":"May"},{"monthID":"6","month":"June"},{"monthID":"7","month":"July"},{"monthID":"8","month":"August"},{"monthID":"9","month":"Septemeber"},{"monthID":"10","month":"October"},{"monthID":"11","month":"November"},{"monthID":"12","month":"December"}]

    Read the article

  • Catch $.getJSON error

    - by Switz
    I've been trying to figure this out for hours. I have a DYNAMIC youtube search, which I use Youtube's JSON api for. It works usually, but there are times that it won't find anything. Is there a way to figure out if it finds nothing, and then end the function because otherwise it stops the entire code. I tried jsonp, but that didn't seem to be correct. Somewhere I read that error catching is built into the newest jQuery getJSON, but I couldn't find it. The code is really tedious so I'd rather not post it unless it comes to that. I'd appreciate any help! Thanks guys. error showing that json didn't return anything jquery-1.4.4.min.js:32 TypeError: Result of expression 'j' [undefined] is not an object.

    Read the article

  • Callback function doesn't work when using getJSON

    - by asilloo
    Hi, This is the code that I am using, When I write the link into the browser (I.E. or Mozilla) it is working like (MyFunc({"memes":[{"source":"http://www.knall......), but when I try to run it as HTML file I have a error in status Bar. what is the problem?. Thanks <head> <style>img{ height: 100px; float: left; }</style> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <div id="images"></div> <script>$.getJSON("http://tagthe.net/api/?url=http://www.knallgrau.at/en&view=json&callback=MyFunc",function(data){ alert(data); }); </script> </body>

    Read the article

  • getJSON for dropbox data

    - by gheil.apl
    Although i used getJSON in http://jsbin.com/dbJSON/edit i have not been able to connect with any of my own made up data. i tried 4, and the example at Flickr for "cats". Only the latter worked... this is the output: {assoc: null,assoc.js: null,stub: null,stub.js: null,cat: [object Object]} i am at that "base", as i did get the image there, but db.tgu.ca/repsychal/poems/10/0512-g2g/assoc.json db.tgu.ca/repsychal/poems/10/0512-g2g/assoc.js db.tgu.ca/repsychal/poems/10/0512-g2g/stub.json db.tgu.ca/repsychal/poems/10/0512-g2g/stub.js were all invisible==null! (they are all URL, just put h t t p //: in front ... a restriction on the # of URL in a post) How do i get "my" data into the page?

    Read the article

  • jQuery getJSON request returning empty on a valid request

    - by mikemike
    I'm trying to grab some JSON from Apple's iTunes JSON service. The request is simple: http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStoreServices.woa/wa/wsSearch?term=jac&limit=25 If you visit the URL in your browser you will see some well-formed (backed up by jsonlint.com) JSON. When I use the following jQuery to make the request, however, the request finds nothing: $("#soundtrack").keypress(function(){ $.getJSON("http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStoreServices.woa/wa/wsSearch",{'term':$(this).val(), 'limit':'25'}, function(j){ var options = ''; for (var i = 0; i < j.results.length; i++) { options += '<option value="' + j.results[i].trackId + '">' + j.results[i].artistName + ' - ' + j.results[i].trackName + '</option>'; } $("#track_id").html(options); }); }); Firebug sees the request, but only receives an empty response. Any help would be appreciated here, as I'm at my whits end trying to solve it. You can view the script here: http://rnmtest.co.uk/gd/drives_admin/add_drive (soundtrack input box is at the bottom of the page). Thanks

    Read the article

  • autocomplete and $.getJSON problem

    - by Dusty Roberts
    Hi There I have a script: <script type="text/javascript"> $(document).ready(function(){ $("#PrincipleMember_IdNumber").autocomplete({ close: function(event, ui) { var member = {}; member.IDNumber = $("#PrincipleMember_IdNumber").val(); $.getJSON("<%= Url.Action("MemberLookup","Member") %>", member, function(data) { $("#PrincipleMember_Firstname").val(data.FirstName); }); } }); }); A form: <fieldset class="fieldsetSection"> <legend>Principle Member</legend> <table> <tr> <td width="150px" class="editor-label"><%=Html.LabelFor(l=>l.PrincipleMember.IdNumber)%></td> <td class="editor-field"><%= Html.AutoCompleteTextBoxFor(i => i.PrincipleMember.IdNumber, "IdNumber", "AutoComplete")%></td> <td><%=Html.ValidationMessageFor(v => v.PrincipleMember.IdNumber)%></td> </tr> <tr> <td width="150px" class="editor-label"><%=Html.LabelFor(l=>l.PrincipleMember.Firstname)%></td> <td class="editor-field"><%=Html.TextBoxFor(t => t.PrincipleMember.Firstname)%></td> <td><%=Html.ValidationMessageFor(v => v.PrincipleMember.Firstname)%></td> </tr> </table> and finally a json result action: public JsonResult MemberLookup(Member member) { member = _memberRepository.GetMember(member.IDNumber); return this.Json(member); } my json result is executed perfectly and i get a result, but for some reason this section of the script is not executing: $("#PrincipleMember_Firstname").val(data.FirstName); i've tried replacing it with an alert();, but that too is not executing. Can anyone see what i am doing wrong here?

    Read the article

  • Combine multiple JSON files into one; retrieve using jQuery/getJSON()

    - by frankadelic
    I have some jQuery code which retrieves content using getJSON(). There are n JSON files, which are retrieved from the server as needed: /json-content/data0.json /json-content/data1.json /json-content/data2.json etc... Instead, I want to store all the JSON in a single file to reduce the number of HTTP requests needed to retrieve the data. What is the best way to do this? If I concatenate the JSON files together, it no longer works with getJSON(). I would prefer not to transform the JSON data ahead of time, as it is coming from a third party data source. Any suggestions?

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >