Search Results

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

Page 9/14 | < Previous Page | 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • How can I access this nested array within my JSON object?

    - by Charles
    I'm using PHP to return a json_encode()'d array for use in my Javascript code. It's being returned as: {"parent1[]":["child1","child2","child2"],"parent2[]":["child1"]} By using the following code, I am able to access parent2 > child1 $.getJSON('myfile.php', function(data) { for (var key in data) { alert(data[key]); } } However, this doesn't give me access to child1, child2, child, of parent1. Alerting the key by itself shows 'parent1' but when I try to alert it's contents, I get undefined. I figured it would give me an object/array? How do I access the children of parent1? data[key][0] ?

    Read the article

  • jQuery - getting the id of the item selected

    - by John Leonard
    I have a basic jQuery selector question. Let's say I'm parsing JSON and generating a row of data for each item in my result set. On each item row, I want an action button. What is the best practice to script that button so its click action can reference the data specific to that row? Starting with the block below, how do I generate a 'Click Me' button that when clicked will alert with its json data? $.getJSON(url,params,function(json){ if(json.items){ $.each(json.items, function(i, n){ var item = json.items[i];

    Read the article

  • Javascript pass reference by value

    - by Carlos R. Batista
    Im having this weird reference issue when im trying to get a JSON file through query: var themeData; $.getJSON("json/sample.js", function(data) { themeData = data.theme; console.log(themeData.sample[0].description); }); console.log(themeData.sample[0].description); The first console.log works, the second doesnt. Im guessing because "data" already expired by the time the script gets there and themeData is just a mere pointer to "data". Is there a ways I can make sure themeData gets a duplicate of "data" and not just a pointer to it?

    Read the article

  • Initializing new instances of a class in a loop, how can I persist an assignment to an event handler

    - by Pydroid
    This is a follow on question from http://stackoverflow.com/questions/3020960/why-is-my-prototype-function-not-returning-the-property-of-the-instance $.getJSON(myjson, function(data) { var json = data; for (i in json) { juuvies[i] = new Juuvy(i,json[i], font, keyfontsize, valfontsize, orbcol, orbkeycol, orbvalcol, paper); juuvies[i].juuv_it(); var mykey = juuvies[i].init_nodes(); juuvies[i].orb.node.onmouseover = function() { console.log(mykey);}; } }); And my init_nodes function, Juuvy.prototype.init_nodes = function() { return this.key; } At this point of time, I get only the last key in the loop, instead of a unique pass each time. Is there a way I can persist the assignment for the event handler?

    Read the article

  • jQuery live, change in not working in IE6, IE7

    - by fabian
    The code below works as expected in FF but not in IEs... $(document).ready(function() { $('div.facet_dropdown select').live('change', function() { var changed_facet = $(this).attr('id'); var facets = $('select', $(this).closest('form')); var args = window.location.href.split('?')[0] + '?ajax=1'; var clear = false; for(var i = 0; i < facets.length; i++) { var ob = $(facets[i]); var val = ob.val(); if(clear) { val = ''; } args += '&' + ob.attr('id') + '=' + val; if(ob.attr('id') == changed_facet) { clear = true; } } $.getJSON(args, function(json) { for(widget_id in json) { var sel = '#field-' + widget_id + ' div.widget'; $(sel).html(json[widget_id]); } }); }); });

    Read the article

  • Best solution to wait for all ajax callbacks to be executed

    - by glaz666
    Hi! Imagine we have to sources to be requested by ajax. I want to perform some actions when all callbacks are triggered. How this can be done besides this approach: (function($){ var sources = ['http://source1.com', 'http://source2.com'], guard = 0, someHandler = function() { if (guard != sources.length) { return; } //do some actions }; for (var idx in sources) { $.getJSON(sources[idx], function(){ guard++; someHandler(); }) } })(jQuery) What I don't like here is that in this case I can't handle response failing (eg. I can't set timeout for response to come) and overall approach (I suppose there should be a way to use more power of functional programming here) Any ideas? Regards!

    Read the article

  • jQuery JSON help

    - by kim
    okay I'm new to jQuery and JSON but I have now done so I got some information from the database in JSON format and now I want to show the results in a nice way but I don't know how ;) what I want is to show 5 newest threads on my page so will this script try to load all the time or do I need to do something else? I want it to show the 5 newest threads and when there somes a new thread i should slide down and the 6 threads at the bottom should disappear Here is my code <script type="text/javascript"> $.getJSON('ajax/forumThreads', function(data) { //$('<p>' + data[0].overskrift + '</p>').appendTo('#updateMe > .overskrift'); $('<div class="overskrift">' + data[0].overskrift + '</div>') { $(this).hide().appendTo('updateMe').slideDown(1000); } //alert(data[0].overskrift); }); </script>

    Read the article

  • How do I clear the text contents of a div in javascript?

    - by Ben
    I'm temporarily adding contents to a div,tempDiv, and adding that to a link which is appended to a div, #contentHere, that's displayed. I need to clear the contents of tempDiv so that the links aren't appended to each other, creating a string of urls that don't link to anywhere. $(document).ready(function(){ $.getJSON("data.php", function(data){ for(i = 0; i < 5; i++){ $("#tempDiv").append(data.justIn[i].dataLink+ ' '); $("#contentHere").append("<a href=\"#tempDiv\">Click to go to the div link</a>"); //I need to clear the contents of tempDiv here } }); }); Solutions to clearing the temporary contents of the div as I go?

    Read the article

  • Error: Get JSON Data from Web API Using Jquery

    - by Kenneth
    I'm really new at this. And I'm really stuck. I have the jquery code, it will load data from Web API, but it does not display on my page. $.getJSON("/api/Order", function(data) { if (data != null) { var str = ''; $.each(data, function (item) { str = '<li>' + item.ItemName + '</li>'; }); $("#contents").append(str); } }); Can anyone explain what is going on? Thanks.

    Read the article

  • Can you use POST to run a query in Solr (/select)

    - by RyanFetz
    I have queries that I am running against out solr index that sometimes have very long query parameters, I get errors when i run these queries, which i assume are do to the limit of a GET query parameters. Here is the method I use to query (JSON), this is to show I am using the Http Extensions (the client i use is a thin wrapper for HttpClient) not an end to end solution. 90% of the queries run fine, it is just when the params are large i get the 500 error from solr. I have read somewhere you can use POSt's when doing the select command but have not found examples of how to do it. Any help would be fantastic! public string GetJson(HttpQueryString qs) { using (var client = new DAC.US.Web.XmlHttpServiceClient(this.Uri)) { client.Client.DefaultHeaders.Authorization = new Microsoft.Http.Headers.Credential("Basic", DAC.US.Encryption.Hash.WebServiceCredintials); qs.Add("wt", "json"); if (!String.IsNullOrEmpty(this.Version)) qs.Add("version", this.Version); using (var response = client.Get(new Uri(@"select/", UriKind.Relative), qs)) { return response.Content.ReadAsString(); } } }

    Read the article

  • Why is this global variable not being changed???

    - by user398314
    Why does this turn up null instead of being set to the data returned from the ajax call? It must be something simple i am overlooking. var message; $(document).ready(function(){ fbFetchMessage(); alert(message); }); function fbFetchMessage(){ var url = "http://graph.facebook.com/companyname/feed?callback=?"; $.getJSON(url,function(json){ message = json.data[0].message; }); }

    Read the article

  • ASP.NET JSON Binding data with RadiobuttonList

    - by user1385570
    I'm trying to bind JSON data into the RadioButtonList on client side. I know how to do the in code behind, it works fine. Someone please provide more details, How do I bind the JSON data RadioButtionList in VB.NET. rblregions.DataTextField = "Value" rblregions.DataValueField = "Key" rblregions.DataSource = items The data looks like: [regions:{regionID:US,regionName:USA}] main.aspx <asp:RadioButtonList ID="rblregions" runat="server"> $.getJSON("Map/loadMySites.aspx?" + query, function (data) { if (data.regionid && data.region) { //I want to bind the data here with RadioButtonList } } );

    Read the article

  • Javascript: best solution to wait for all ajax callbacks to be executed

    - by glaz666
    Hi! Imagine we have to sources to be requested by ajax. I want to perform some actions when all callbacks are triggered. How this can be done besides this approach: (function($){ var sources = ['http://source1.com', 'http://source2.com'], guard = 0, someHandler = function() { if (guard != sources.length) { return; } //do some actions }; for (var idx in sources) { $.getJSON(sources[idx], function(){ guard++; someHandler(); }) } })(jQuery) What I don't like here is that in this case I can't handle response failing (eg. I can't set timeout for response to come) and overall approach (I suppose there should be a way to use more power of functional programming here) Any ideas? Regards!

    Read the article

  • how to pass parameter to partial view in MVC4 razor

    - by user2139492
    In my asp.net mvc 4 application i want to pass a parameter to partial view,however the parameter we want to pass is coming from javascript code Below is the code <script> var TestId; $(document).ready(function () { // Send an AJAX request $.getJSON("/api//GetFun?Id="[email protected], function (data) { TestId= data.Id //i am getting the id here which i need to pass in partial view } 1)........... }); </script> html code: <div id="tab1" > 2).... @{ Html.RenderAction("MyPartialView", "MyController", new { id = TestId });} </div> So let me know how can i pass the test id to my partial view :in HTML(2) code or in javascript (1)

    Read the article

  • Selecting a portion of a JSON array and applying variables in javascript or jquery

    - by user1644609
    I am retrieving a JSON file that returns its results like what you see below. The JSON has 365 days worth of data. I would like to create "views" of this JSON using javascript, one which pulls the last 10 days, then 1 month, 6 months, etc. After the getJSON function I am doing this to get a string as JSON, then turn it into an object and will then graph it. So I would like each "view" to be an object for the specified timeframe (using the one JSON). The obj_10days, obj_1month, etc variables would then be plotted. var $ graph = data ; var obj = $ . parseJSON ( $ graph ) ; JSON: [ { "Low": 8.63, "Volume": 14211900, "Date": "2012-10-26", "High": 8.79, "Close": 8.65, "Adj Close": 8.65, "Open": 8.7 }, { "Low": 8.65, "Volume": 12167500, "Date": "2012-10-25", "High": 8.81, "Close": 8.73, "Adj Close": 8.73, "Open": 8.76 }, { "Low": 8.68, "Volume": 20239700, "Date": "2012-10-24", "High": 8.92, "Close": 8.7, "Adj Close": 8.7, "Open": 8.85 }, Any help is appreciated, thank you!

    Read the article

  • Memory leak involving jQuery Ajax requests

    - by Eli Courtwright
    I have a webpage that's leaking memory in both IE8 and Firefox; the memory usage displayed in the Windows Process Explorer just keeps growing over time. The following page requests the "unplanned.json" url, which is a static file that never changes (though I do set my Cache-control HTTP header to no-cache to make sure that the Ajax request always goes through). When it gets the results, it clears out an HTML table, loops over the json array it got back from the server, and dynamically adds a row to an HTML table for each entry in the array. Then it waits 2 seconds and repeats this process. Here's the entire webpage: <html> <head> <title>Test Page</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> </head> <body> <script type="text/javascript"> function kickoff() { $.getJSON("unplanned.json", resetTable); } function resetTable(rows) { $("#content tbody").empty(); for(var i=0; i<rows.length; i++) { $("<tr>" + "<td>" + rows[i].mpe_name + "</td>" + "<td>" + rows[i].bin + "</td>" + "<td>" + rows[i].request_time + "</td>" + "<td>" + rows[i].filtered_delta + "</td>" + "<td>" + rows[i].failed_delta + "</td>" + "</tr>").appendTo("#content tbody"); } setTimeout(kickoff, 2000); } $(kickoff); </script> <table id="content" border="1" style="width:100% ; text-align:center"> <thead><tr> <th>MPE</th> <th>Bin</th> <th>When</th> <th>Filtered</th> <th>Failed</th> </tr></thead> <tbody></tbody> </table> </body> </html> If it helps, here's an example of the json I'm sending back (it's this exact array wuith thousands of entries instead of just one): [ { mpe_name: "DBOSS-995", request_time: "09/18/2009 11:51:06", bin: 4, filtered_delta: 1, failed_delta: 1 } ] EDIT: I've accepted Toran's extremely helpful answer, but I feel I should post some additional code, since his removefromdom jQuery plugin has some limitations: It only removes individual elements. So you can't give it a query like `$("#content tbody tr")` and expect it to remove all of the elements you've specified. Any element that you remove with it must have an `id` attribute. So if I want to remove my `tbody`, then I must assign an `id` to my `tbody` tag or else it will give an error. It removes the element itself and all of its descendants, so if you simply want to empty that element then you'll have to re-create it afterwards (or modify the plugin to empty instead of remove). So here's my page above modified to use Toran's plugin. For the sake of simplicity I didn't apply any of the general performance advice offered by Peter. Here's the page which now no longer memory leaks: <html> <head> <title>Test Page</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> </head> <body> <script type="text/javascript"> <!-- $.fn.removefromdom = function(s) { if (!this) return; var el = document.getElementById(this.attr("id")); if (!el) return; var bin = document.getElementById("IELeakGarbageBin"); //before deleting el, recursively delete all of its children. while (el.childNodes.length > 0) { if (!bin) { bin = document.createElement("DIV"); bin.id = "IELeakGarbageBin"; document.body.appendChild(bin); } bin.appendChild(el.childNodes[el.childNodes.length - 1]); bin.innerHTML = ""; } el.parentNode.removeChild(el); if (!bin) { bin = document.createElement("DIV"); bin.id = "IELeakGarbageBin"; document.body.appendChild(bin); } bin.appendChild(el); bin.innerHTML = ""; }; var resets = 0; function kickoff() { $.getJSON("unplanned.json", resetTable); } function resetTable(rows) { $("#content tbody").removefromdom(); $("#content").append('<tbody id="id_field_required"></tbody>'); for(var i=0; i<rows.length; i++) { $("#content tbody").append("<tr><td>" + rows[i].mpe_name + "</td>" + "<td>" + rows[i].bin + "</td>" + "<td>" + rows[i].request_time + "</td>" + "<td>" + rows[i].filtered_delta + "</td>" + "<td>" + rows[i].failed_delta + "</td></tr>"); } resets++; $("#message").html("Content set this many times: " + resets); setTimeout(kickoff, 2000); } $(kickoff); // --> </script> <div id="message" style="color:red"></div> <table id="content" border="1" style="width:100% ; text-align:center"> <thead><tr> <th>MPE</th> <th>Bin</th> <th>When</th> <th>Filtered</th> <th>Failed</th> </tr></thead> <tbody id="id_field_required"></tbody> </table> </body> </html> FURTHER EDIT: I'll leave my question unchanged, though it's worth noting that this memory leak has nothing to do with Ajax. In fact, the following code would memory leak just the same and be just as easily solved with Toran's removefromdom jQuery plugin: function resetTable() { $("#content tbody").empty(); for(var i=0; i<1000; i++) { $("#content tbody").append("<tr><td>" + "DBOSS-095" + "</td>" + "<td>" + 4 + "</td>" + "<td>" + "09/18/2009 11:51:06" + "</td>" + "<td>" + 1 + "</td>" + "<td>" + 1 + "</td></tr>"); } setTimeout(resetTable, 2000); } $(resetTable);

    Read the article

  • How to display a JSON error message?

    - by Tiny Giant Studios
    I'm currently developing a tumblr theme and have built a jQuery JSON thingamabob that uses the Tumblr API to do the following: The user would click on the "post type" link (e.g. Video Posts), at which stage jQuery would use JSON to grab all the posts that's related to that type and then dynamically display them in a designated area. Now everything works absolutely peachy, except that with Tumblr being Tumblr and their servers taking a knock every now and then, the Tumblr API thingy is sometimes offline. Now I can't foresee when this function will be down, which is why I want to display some generic error message if JSON (for whatever reason) was unable to load the post. You'll see I've already written some code to show an error message when jQuery can't find any posts related to that post type BUT it doesn't cover any server errors. Note: I sometimes get this error: Failed to load resource: the server responded with a status of 503 (Service Temporarily Unavailable) It is for this 503 Error message that I need to write some code, but I'm slightly clueless :) Here's the jQuery JSON code: $('ul.right li').find('a').click(function() { var postType = this.className; var count = 0; byCategory(postType); return false; function byCategory(postType, callback) { $.getJSON('{URL}/api/read/json?type=' + postType + '&callback=?', function(data) { var article = []; $.each(data.posts, function(i, item) { // i = index // item = data for a particular post switch(item.type) { case 'photo': article[i] = '<div class="post_wrap"><div class="photo" style="padding-bottom:5px;">' + '<a href="' + item.url + '" title="{Title}" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/XSTldh6ds/photo_icon.png" alt="type_icon"/></a>' + '<a href="' + item.url + '" title="{Title}"><img src="' + item['photo-url-500'] + '"alt="image" /></a></div></div>'; count = 1; break; case 'video': article[i] = '<div class="post_wrap"><div class="video" style="padding-bottom:5px;">' + '<a href="' + item.url + '" title="{Title}" class="type_icon">' + '<img src="http://static.tumblr.com/ewjv7ap/nuSldhclv/video_icon.png" alt="type_icon"/></a>' + '<span style="margin: auto;">' + item['video-player'] + '</span>' + '</div></div>'; count = 1; break; case 'audio': if (use_IE == true) { article[i] = '<div class="post_wrap"><div class="regular">' + '<a href="' + item.url + '" title="{Title}" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/R50ldh5uj/audio_icon.png" alt="type_icon"/></a>' + '<h3><a href="' + item.url + '">' + item['id3-artist'] +' - ' + item['id3-title'] + '</a></h3>' + '</div></div>'; } else { article[i] = '<div class="post_wrap"><div class="regular">' + '<a href="' + item.url + '" title="{Title}" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/R50ldh5uj/audio_icon.png" alt="type_icon"/></a>' + '<h3><a href="' + item.url + '">' + item['id3-artist'] +' - ' + item['id3-title'] + '</a></h3><div class="player">' + item['audio-player'] + '</div>' + '</div></div>'; }; count = 1; break; case 'regular': article[i] = '<div class="post_wrap"><div class="regular">' + '<a href="' + item.url + '" title="{Title}" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/dwxldhck1/regular_icon.png" alt="type_icon"/></a><h3><a href="' + item.url + '">' + item['regular-title'] + '</a></h3><div class="description_container">' + item['regular-body'] + '</div></div></div>'; count = 1; break; case 'quote': article[i] = '<div class="post_wrap"><div class="quote">' + '<a href="' + item.url + '" title="{Title}" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/loEldhcpr/quote_icon.png" alt="type_icon"/></a><blockquote><h3><a href="' + item.url + '" title="{Title}">' + item['quote-text'] + '</a></h3></blockquote><cite>- ' + item['quote-source'] + '</cite></div></div>'; count = 1; break; case 'conversation': article[i] = '<div class="post_wrap"><div class="chat">' + '<a href="' + item.url + '" title="{Title}" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/MVuldhcth/conversation_icon.png" alt="type_icon"/></a><h3><a href="' + item.url + '">' + item['conversation-title'] + '</a></h3></div></div>'; count = 1; break; case 'link': article[i] = '<div class="post_wrap"><div class="link">' + '<a href="' + item.url + '" title="{Title}" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/EQGldhc30/link_icon.png" alt="type_icon"/></a><h3><a href="' + item['link-url'] + '" target="_blank">' + item['link-text'] + '</a></h3></div></div>'; count = 1; break; default: alert('No Entries Found.'); }; }) // end each if (!(count == 0)) { $('#content_right') .hide('fast') .html('<div class="first_div"><span class="left_corner"></span><span class="right_corner"></span><h2>Displaying ' + postType + ' Posts Only</h2></div>' + article.join('')) .slideDown('fast') } else { $('#content_right') .hide('fast') .html('<div class="first_div"><span class="left_corner"></span><span class="right_corner"></span><h2>Hmmm, currently there are no ' + postType + ' posts to display</h2></div>') .slideDown('fast') } // end getJSON }); // end byCategory } }); If you'd like to see the demo in action, check out Elegantem but do note that everything might work absolutely fine for you (or not), depending on Tumblr's temperament.

    Read the article

  • How can I get the data from the json one by one by using javascript/jquery? [on hold]

    - by sandhus
    I have the working code which fetches all the records from the json, but how can I make it available one by one on the click of the button or link? The following code is working to fetch all the records: <!doctype html> <html> <head> <meta charset="utf-8"> <title>jQuery PHP Json Response</title> <style type="text/css"> div { text-align:center; padding:10px; } #msg { width: 500px; margin: 0px auto; } .members { width: 500px ; background-color: beige; } </style> </head> <body> <div id="msg"> <table id="userdata" border="1"> <thead> <th>Email</th> <th>Sex</th> <th>Location</th> <th>Picture</th> <th>audio</th> <th>video</th> </thead> <tbody></tbody> </table> </div> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"> </script> <script type="text/javascript"> $(document).ready(function(){ var url="json.php"; $("#userdata tbody").html(""); $.getJSON(url,function(data){ $.each(data.members, function(i,user){ var tblRow = "<tr>" +"<td>"+user.email+"</td>" +"<td>"+user.sex+"</td>" +"<td>"+user.location+"</td>" +"<td>"+"<img src="+user.image+">"+"</td>" +"<td>"+"<audio src="+user.video+" controls>"+"</td>" +"<td>"+"<video src="+user.video+" controls>"+"</td>" +"</tr>" ; $(tblRow).appendTo("#userdata tbody"); }); }); }); </script> </body> </html> I used the json_encode function in the php file to encode the sql db. How can i achieve this?

    Read the article

  • CKEditor inside jQuery Dialog, how do I build it?

    - by Ben Dauphinee
    So, I'm working with CKEditor and jQuery, trying to build a pop-out editor. Below is what I have coded so far, and I can't seem to get it working the way I want it to. Basically, click the 'Edit' link, dialog box pops up, with the content to edit loaded into the CKEditor. Also, not required, but helpful if you can suggest how to do it. I can't seem to find out how to make the save button work in CKEditor (though I think the form will do it). Thanks in advance for any help. $(document).ready(function(){ var config = new Array(); config.height = "350px"; config.resize_enabled = false; config.tabSpaces = 4; config.toolbarCanCollapse = false; config.width = "700px"; config.toolbar_Full = [["Save","-","Cut","Copy","Paste","-","Undo","Redo","-","Bold","Italic", "-", "NumberedList","BulletedList","-","Link","Unlink","-","Image","Table"]]; $("a.opener").click(function(){ var editid = $(this).attr("href"); var editwin = \'<form><div id="header"><input type="text"></div><div id="content"><textarea id="content"></textarea></div></form>\'; var $dialog = $("<div>"+editwin+"</div>").dialog({ autoOpen: false, title: "Editor", height: 360, width: 710, buttons: { "Ok": function(){ var data = $(this).val(); } } }); //$(this).dialog("close"); $.getJSON("ajax/" + editid, function(data){ alert("datagrab"); $dialog.("textarea#content").html(data.content).ckeditor(config); alert("winset"); $dialog.dialog("open"); }); return false; }); });

    Read the article

  • jQuery - .Ready fires on div tag not in the page

    - by Anders Juul
    Dear all, I have implemented below function in a separate .js script file which I load in my main page (Asp.net mvc). The call back to server is rather costly but ok if specifically requested on the sub-page / content page on which my div tag needs to be filled. My problem is that the code runs on every page, including pages where the div tag is not present. How can I remedy my code? Any comments welcome, Thanks, Anders, Denmark jQuery("divStatWrapper").ready(function() { jQuery.getJSON("/Statistics/GetPointsDevelopment", function(json) { jQuery("#divStatWrapper #divStatLoading").fadeOut(1000); var jsonPoints = new Array(); jQuery.each(json.Points, function(i, item) { jsonPoints.push(item.PlayerPoints ); }); jsonPoints.reverse(); var api = new jGCharts.Api(); jQuery('<img>') .attr('src', api.make({ data : jsonPoints, type : "lc", size : "600x250" })) .appendTo("#divStatContents"); jQuery("#divStatWrapper #divStatContents").fadeIn(1000); }); });

    Read the article

  • Blockchain API, AJAX request has stopped working, CORS issues?

    - by Sly
    I've been playing with the multiple address look up API from blockchain info (documented here https://blockchain.info/api/blockchain_api), I had my code working earlier in the day but bizzarely it's stopped. The purpose of it is to eventually write a little JQuery library which will search the DOM for bitcoin addresses as data attributes and then insert the final balance into that element creating a polling mechanism to keep the page updated as well. The original problem I ran into earlier while developing it was because it's a CORS ajax request but later I adjusted the query per the blockchain info API documents and I added cors=true it then seemed to work fine but now it doesn't seem to want to work at all again. I don't get how changing computers would effect this kind of request. Here's my code on JSFiddle, http://jsfiddle.net/SlyFoxy12/9mr7L/7/ My primary code is: (function ($) { var methods = { init: function(data, options) { //put your init logic here. }, query_addresses: function(addresses) { var addresses_implode = addresses.join("|"); $.getJSON("http://blockchain.info/multiaddr?cors=true&active="+addresses_implode, function( data ) { $.each( data.addresses, function( index ) { $('#output').append(" "+data.addresses[index].final_balance); }); }); } }; $.fn.bitstrap = function () { var addresses = new Array(); $('[data-xbt-address]').each(function () { $(this).text($(this).data('xbtAddress')); addresses.push($(this).data('xbtAddress')); }); methods.query_addresses(addresses); } }(jQuery)); $().ready(function() { $().bitstrap(); });

    Read the article

  • Problem with JSONResult

    - by vikitor
    Hi, I' still newby to this so I'll try to explain what I'm doing. Basically what I want is to load a dropdownlist depending on the value of a previous one, and I want it to load the data and appear when the other one is changed. This is the code I've written in my controller: public ActionResult GetClassesSearch(bool ajax, string phylumID, string kingdom){ IList<TaxClass> lists = null; int _phylumID = int.Parse(phylumID); int _kingdom = int.Parse(kingdom); lists = _taxon.getClassByPhylumSearch(_phylumID, _kingdom); return Json(lists.count); } and this is how I call the method from the javascript function: function loadClasses(_phylum) { var phylum = _phylum.value; $.getJSON("/Suspension/GetClassesSearch/", { ajax: true, phylumID: phylum, kingdom: kingdom }, function(data) { alert(data); alert('no fallo') document.getElementById("pClass").style.display = "block"; document.getElementById("sClass").options[0] = new Option("-select-", "0", true, true); //for (i = 0; i < data.length; i++) { // $('#sClass').addOption(data[i].classID, data[i].className); //} }); } The thing is that just like this it works, I pass the function the number of classes within a selected phylum, and it displays the pclass element, the problem gets when I try to populate the slist with data (which should contain the objects retrieved from the database), because when there is data returned by the database changing return Json(lists) instead of return Json(lists.count) I keep getting the same error: A circular reference was detected while serializing an object of type 'SubSonic.Schema.DatabaseColumn'. I've been going round and round debugging and making tests but I can't make it work, and it is suppossed to be a simple thing, but I'm missing something. I have commented the for loop because I'm not quite sure if that's the way you access the data, because I've not been able to make it work when it finds records. Can anyone help me? Thanks in advance, Victor

    Read the article

  • Forms authentication, ASP.NET MVC and WCF RESTful service

    - by J F
    One test webserver, with the following applications service.ganymedes.com:8008 - WCF RESTful service, basically the FormsAuth sample from WCF Starter Kit Preview 2 mvc.ganymedes.com:8008 - ASP.NET MVC 2.0 application web.config for service.ganymedes.com: <authentication mode="Forms"> <forms loginUrl="~/login.aspx" timeout="2880" domain="ganymedes.com" name="GANYMEDES_COOKIE" path="/" /> </authentication> web.config for mvc.ganymedes.com: <authentication mode="Forms"> <forms loginUrl="~/Account/LogOn" timeout="2880" domain="ganymedes.com" name="GANYMEDES_COOKIE" path="/" /> </authentication> Trying my darndest, a GET (or POST for that matter) via jQuery's $.ajax or getJson does not send my cookie (according to Firebug), so I get HTTP 302 returned from the WCF service: Request Headers Host service.ganymedes.com:8008 User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 (.NET CLR 3.5.30729) Accept application/json, text/javascript, */* Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 300 Connection keep-alive Referer http://mvc.ganymedes.com:8008/Test Origin http://mvc.ganymedes.com:8008 It's sent when mucking about on the MVC site though: Request Headers Host mvc.ganymedes.com:8008 User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 (.NET CLR 3.5.30729) Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 300 Connection keep-alive Referer http://mvc.ganymedes.com:8008/Test Cookie GANYMEDES_COOKIE=0106A4A666C8C615FBFA9811E9A6C5219C277D625C04E54122D881A601CD0E00C10AF481CB21FAED544FAF4E9B50C59CDE2385644BBF01DDD4F211FE7EE8FAC2; GANYMEDES_COOKIE=D6569887B7C5B67EFE09079DD59A07A98311D7879817C382D79947AE62B5508008C2B2D2112DCFCE5B8D4C61D45A109E61BBA637FD30315C2D8353E8DDFD4309 I also put the exact same settings in both applications' web.config files (self-generated validationKey and decryptionKey).

    Read the article

  • jquery ui autocomplete problem

    - by Roger
    Hi, i've got a select box containing countries, and when one is selected, i want my autocomplete data for the city field to load via ajax. here's my code: // Sets up the autocompleter depending on the currently // selected country $(document).ready(function() { var cache = getCities(); $('#registration_city_id').autocomplete( { source: cache } ); cache = getCities(); // update the cache array when a different country is selected $("#registration_country_id").change(function() { cache = getCities(); }); }); /** * Gets the cities associated with the currently selected country */ function getCities() { var cityId = $("#registration_country_id :selected").attr('value'); return $.getJSON("/ajax/cities/" + cityId + ".html"); } This returns the following json: ["Aberdare","Aberdeen","Aberystwyth","Abingdon","Accrington","Airdrie","Aldershot","Alfreton","Alloa","Altrincham","Amersham","Andover","Antrim","Arbroath","Ardrossan","Arnold","Ashford","Ashington","Ashton-under-Lyne","Atherton","Aylesbury","Ayr",... ] But, it doesn't work. When i start typing in the city box, the style changes so the autocompleter is doing something, but it won't display this data. If i hard-code the above it works. Can anyone see what's wrong? Thanks

    Read the article

  • jQuery autopopulate select drop down from JSON issues

    - by Jonathon Joyce
    I have an issue regarding to auto populating a select dropdown from jQuery/JSON data which is return from a ColdFusion CFC, the code is below: $(function(){ $("#licences-add").dialog({autoOpen:false,modal:true,title:'Add Licences',height:250,width:380}); }); function openAddLicence(intInstanceID,szName,szDatasourceName){ $.getJSON('/ASPAdmin/billing/handler.cfc?method=ListLicenceTypes&queryformat=column',{szInstanceDatasource:szDatasourceName}, function(data){ $.each(data,function(){ $('<option></option>').val(data.DATA.UUIDLICENCETYPE).text(data.DATA.SZLICENCETYPE).appendTo('#uuidLicenceType'); }); }); $("#intInstanceID").attr('value', intInstanceID); $('span#szInstanceName').text(szName); $("#licences-add").dialog('open');}; The json returned is: {"ROWCOUNT":1,"COLUMNS":["UUIDLICENCETYPE","SZLICENCETYPE"],"DATA":{"UUIDLICENCETYPE":["480CE560-BCD3-C7AC-AF50B3C71BBCC473"],"SZLICENCETYPE":["Standard"]}} However i get the following error: $("").val(this.UUIDLICENCETYPE).text is not a function Any ideas? HTML: <tr> <td><label for="uuidLicenceType" title="Select the licence type (required).">Licence Type</label> <span class="req">*</span></td> <td> <select name="uuidLicenceType" id="uuidLicenceType" class="bmSelect"> <option value=""></option> </select> </td> </tr>

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14  | Next Page >