Search Results

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

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

  • Dynamic content in ExtJS Window

    - by Ozaki
    TLDR I want to add some dynamic content into an Ext-JS window / popup. Currently I have tried assigning this content to a div and pulling on the innerhtml of that div like: new Ext.Window({ height: 50, width: 160, x: 0, y: 30, layout: "fit", html: document.getElementById('output').innerHTML; }).show(); Am using jquery & getjson to get the dynamic data. But that does nothing at all. Has anyone done something similar before? Can I give the html of the window an id and use it like an element?

    Read the article

  • JQuery UI: Accordion callbacks

    - by user177215
    I need my javascript to only do the callback when I OPEN a section on the accordion, as of right now it does a callback when I open OR close a section because I'm only using a click function. Is there a way I can modify my existing click function to only run when the given section is activated? My current click function: $("a#mimetypes").click(function() { $("span#mimetypesthrobber").loading(true, { max: 1500 }) $.getJSON("../mimetypes", function(data) { //callback }); }); Thanks! EDIT: I already tried this with another part of the accordion and it wasn't working properly: $('.ui-accordion').bind('accordionchange', function(event, ui) { if (ui.newHeader == "Encoders") { EncodersGet(); } });

    Read the article

  • jQuery with json

    - by coure06
    I have the following json code file named: sections.json { "section1": { "priority": 1, "html": '<img src="../images/google.png" />'}, "section2": { "priority": 2, "html": '<input type="button" value="Login" />'}, "section3": { "priority": 3, "html": '<div>Some text</div>'}, "section4": { "priority": 4, "html": '<div>Some text</div>'}, "section5": { "priority": 5, "html": '<select><option>option1</option> <option>option2</option></select>'} } I am trying this in jquery code but alert is not working $.getJSON("sections.json", function(json) { alert('h'); });

    Read the article

  • Posting from JQuery to WCF Service

    - by Villager
    Hello, I have a WCF Service (called "myservice.svc") that takes a message from a user and saves it to the database. It returns a response to the user in the form of a number. This operation looks like this: [OperationContract] [WebGet] public string SubmitMessage(string message) { try { // SAVE TO DATABASE return "1"; } catch (Exception ex) { return "0"; } } I want to call this operation from some JQuery. I'm using the approach shown here: $.getJSON( "/services/myService.svc", {message:"some text"}, function (data) { alert("success"); } ); Oddly, the "success" alert is never displayed. In addition, I have set a breakpoint in my WCF service and it is never being tripped. What am I doing wrong? Thank you

    Read the article

  • Getting an empty response when calling CouchDB over ajax

    - by swilliams
    I'm new to CouchDB, so please bear with me. I have an instance of CouchDB running on a VM. I can access it just fine through the browser via futon or directly at: http://192.168.62.128:5984/articles/hot_dog Calling that URL in a browser returns the proper JSON. But, when I try to call that exact same URL via ajax, I get nothing: var ajaxUrl = 'http://192.168.62.128:5984/articles/hot_dog'; $.getJSON(ajaxUrl, null, function(data) { alert(data); }); Looking at the response header with Firebug shows me that the HTTP response was 200 and the content-length is the right size. Even the Etag matches with what is in CouchDB. But the response itself is empty! The URL is absolutely right; I've triple checked, and copy/pasted it directly (and besides it wouldn't give a 200 response if it weren't). I'm using jQuery 1.4.2, and CouchDB 0.8 What's going on?

    Read the article

  • Problem in JsonResult

    - by Saravanan I M
    I am using the jsonresult for listing all the cities under a country. I retrieve the data from database and load it to a dropdown list using jquery. The problem is if the cities goes beyond 3000 then the jsonresult is not working. <script type="text/javascript"> $(document).ready(function () { //Hook onto the MakeID list's onchange event $("#Country").change(function () { //build the request url $("#HomeTown").empty(); var url = '<%= Url.Content("~/") %>' + "Location/GetCitiesByCountry/" + $("#Country").val(); $.getJSON(url, function (data) { $.each(data, function (index, optionData) { $("#HomeTown").append("<option value='" + optionData.geonameid + "'>" + optionData.asciiname + "</option>"); }); $("#HomeTown").option[0].selected = true; }); }).change(); }); </script>

    Read the article

  • Converting Json to Java

    - by Binaryrespawn
    Hi all, I want to be able to access properties from a json string within my java action method. The string is available by simply saying myJsonString = object.getJson(); Below is an example of what the string can look like: {'title': 'Computing and Information systems','id':1,'children': 'true','groups': [{'title': 'Level one CIS','id':2,'children': 'true','groups':[{'title': 'Intro To Computing and Internet','id':3,'children': 'false','groups':[]}]}]} In this string every json object contains an array of other json objects. The intention is to extract a list of id's where any given object possessing a group property that contains other json objects. I looked at google's Gson as a potential json plugin. Can anyone offer some form of guidance as to how I can generate java from this json string? Thank you, Kind regards.

    Read the article

  • jquery html attribute not working in IE

    - by Gopal
    I am using country and state dropdowns in my form. Whenever the user selects the country in the dropdown, the respective states of the country will populate in the states dropdown. I am populating the states in the dropdown using ajax call. The problem is that the states get populated in Mozilla but it doesnt work in IE. I guess there is some problem in jquery while loading the states in the states dropdown. The jquery code i am using is $('select#edit-country').change(function(e) { $.getJSON("loadContactUsStates",{id: $(this).val(), ajax: 'true'}, function(j){ var options = ''; for (var i = 0; i < j.length; i++) { options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>'; } <!-----I guess the problem is with the below line------------------> $("select#edit-state").html(options); })//end json });

    Read the article

  • Google Maps - Reserve Geocode -> Error "invalid label"

    - by Newbie
    Hello! I have the coordinates of my marker. Now I want to get the address of the marker. So I searched the web and found google maps reserve geocode. Now I tried to do the following: $.getJSON('http://maps.google.com/maps/api/geocode/json?latlng='+point.lat()+','+ point.lng() +'&key='+apiKey+'&sensor=false&output=json&callback=?', function(data) { console.log(data); }); When I try to show the address, meaning getting the json, firebug throws the following error: invalid label on "status": "OK",\n I searched a lot, but didn't find an answer solving my problem. Can you tell me whats wrong with my code? Is there another way to get the address data for the coordinates?

    Read the article

  • Dynamically add new HTML elements on page load after getting JSON data from Web API

    - by Luis D Urraca
    I'm building an hybrid Android App using Phonegap/Apache Cordova. My app should get data from my web api. I'm using JSON to serve the data to the APP. So i got a the following code: function init() { document.addEventListener('deviceready', onDeviceReady, false); var url = "http://23.21.128.153:3000/regions.json";var jsonresults; $.getJSON(url,function(data){ jsonresults = data; $.each(jsonresults, function(i,v){ $('#main-content').append('<li>'+jsonresults[i].name+'</li>'); }); }); } and also on the body of the html i have a div called main-content. Everythings works fine in the Eclipse browser, but on the Android Emulator is not working. Not sure if there's another way to pull data from Web API using JSON and dinamically create HMTL elements after getting the data. https://gist.github.com/2956660

    Read the article

  • Repopulating a collection of Backbone forms with previously submitted data

    - by Brian Wheat
    I am able to post my forms to my database and I have stepped through my back end function to check and see that my Get function is returning the same data I submitted. However I am having trouble understanding how to have this data rendered upon visiting the page again. What am I missing? The intention is to be able to create, read, update, or delete (CRUD) some personal contact data for a variable collection of individuals. //Model var PersonItem = Backbone.Model.extend({ url: "/Application/PersonList", idAttribute: "PersonId", schema: { Title: { type: 'Select', options: function (callback) { $.getJSON("/Application/GetTitles/").done(callback); } }, Salutation: { type: 'Select', options: ['Mr.', 'Mrs.', 'Ms.', 'Dr.'] }, FirstName: 'Text', LastName: 'Text', MiddleName: 'Text', NameSuffix: 'Text', StreetAddress: 'Text', City: 'Text', State: { type: 'Select', options: function (callback) { $.getJSON("/Application/GetStates/").done(callback); } }, ZipCode: 'Text', PhoneNumber: 'Text', DateOfBirth: 'Date', } }); Backbone.Form.setTemplates(template, PersonItem); //Collection var PersonList = Backbone.Collection.extend({ model: PersonItem , url: "/Application/PersonList" }); //Views var PersonItemView = Backbone.Form.extend({ tagName: "li", events: { 'click button.delete': 'remove', 'change input': 'change' }, initialize: function (options) { console.log("ItemView init"); PersonItemView.__super__.initialize.call(this, options); _.bindAll(this, 'render', 'remove'); console.log("ItemView set attr = " + options); }, render: function () { PersonItemView.__super__.render.call(this); $('fieldset', this.el).append("<button class=\"delete\" style=\"float: right;\">Delete</button>"); return this; }, change: function (event) { var target = event.target; console.log('changing ' + target.id + ' from: ' + target.defaultValue + ' to: ' + target.value); }, remove: function () { console.log("delete button pressed"); this.model.destroy({ success: function () { alert('person deleted successfully'); } }); return false; } }); var PersonListView = Backbone.View.extend({ el: $("#application_fieldset"), events: { 'click button#add': 'addPerson', 'click button#save': 'save2db' }, initialize: function () { console.log("PersonListView Constructor"); _.bindAll(this, 'render', 'addPerson', 'appendItem', 'save'); this.collection = new PersonList(); this.collection.bind('add', this.appendItem); //this.collection.fetch(); this.collection.add([new PersonItem()]); console.log("collection length = " + this.collection.length); }, render: function () { var self = this; console.log(this.collection.models); $(this.el).append("<button id='add'>Add Person</button>"); $(this.el).append("<button id='save'>Save</button>"); $(this.el).append("<fieldset><legend>Contact</legend><ul id=\"anchor_list\"></ul>"); _(this.collection.models).each(function (item) { self.appendItem(item); }, this); $(this.el).append("</fieldset>"); }, addPerson: function () { console.log("addPerson clicked"); var item = new PersonItem(); this.collection.add(item); }, appendItem: function (item) { var itemView = new PersonItemView({ model: item }); $('#anchor_list', this.el).append(itemView.render().el); }, save2db: function () { var self = this; console.log("PersonListView save"); _(this.collection.models).each(function (item) { console.log("item = " + item.toJSON()); var cid = item.cid; console.log("item.set"); item.set({ Title: $('#' + cid + '_Title').val(), Salutation: $('#' + cid + '_Salutation').val(), FirstName: $('#' + cid + '_FirstName').val(), LastName: $('#' + cid + '_LastName').val(), MiddleName: $('#' + cid + '_MiddleName').val(), NameSuffix: $('#' + cid + '_NameSuffix').val(), StreetAddress: $('#' + cid + '_StreetAddress').val(), City: $('#' + cid + '_City').val(), State: $('#' + cid + '_State').val(), ZipCode: $('#' + cid + '_ZipCode').val(), PhoneNumber: $('#' + cid + '_PhoneNumber').val(), DateOfBirth: $('#' + cid + '_DateOfBirth').find('input').val() }); if (item.isNew()) { console.log("item.isNew"); self.collection.create(item); } else { console.log("!item.isNew"); item.save(); } }); return false; } }); var personList = new PersonList(); var view = new PersonListView({ collection: personList }); personList.fetch({ success: function () { $("#application_fieldset").append(view.render()); } });

    Read the article

  • Inserting a rails link into a Google Maps infowindow

    - by Sonia
    Hi, I would like to insert a link into the Google Maps InfoWindow to show more information about the point the user has clicked on in my rails app. My current code: $.getJSON("/places", function(json) { if (json.length > 0) { for (i=0; i<json.length; i++) { var place = json[i]; addLocation(place); } } }); function addLocation(place) { var point = new GLatLng(place.lat, place.lng); var marker = new GMarker(point); map.addOverlay(marker); GEvent.addListener(marker, "click", function() { var info = place.name + "<br>[link]"; map.openInfoWindowHtml(point, info); }); } I would like the link to take the user to the page for that marker (ie. /places/id), but am unsure of how to go about this...any help would be much appreciated!

    Read the article

  • PHP and JSON comment help..

    - by jay
    hi, guys thanks for looking my problem is that i cant seem to get jquery to display my generated data. here is my JSON output ("posts":[{"id":"1-2","time":"0","name":"dash","avatar":"http:\/\/www.gravatar.com\/avatar\/9ff30cc2646099e31a4ee4c0376091b0?s=182&d=identicon&r=PG","comment":"rtetretrete tet rt uh utert"},{"id":"2-2","time":"0","name":"james","avatar":"http:\/\/www.gravatar.com\/avatar\/d41d8cd98f00b204e9800998ecf8427e?s=182&d=identicon&r=PG","comment":"fsdfdfsdf\r\n"}]) and here is my jquery $(document).ready(function(){ var url="comments.php"; $.getJSON(url,function(json){ $.each(json.posts,function(i,post){ $("#content").append( '<div class="post">'+ '<h1>'+post.name+'</h1>'+ '<p>'+post.comment+'</p>'+ '<p>added: <em>'+post.time+'</em></p>'+ '<p>posted by: <strong>'+post.name+'</strong></p>'+ '<p>avatar: <strong>'+post.avatar+'</strong></p>'+ '</div>' ); }); }); });

    Read the article

  • jQuery Address double load on init

    - by dazhall
    Hi All! I'm using jQuery Address to load in my content, but it's doing it twice on the init. I set it up so that if you go to the main category it loads the first image, but it's doing it twice and I'm not sure how to stop it. A fresh pair of eyes would be appreciated! $.address.init(function(event) { $('#carousel-clip a').address(); if(!event.pathNames[0]) { var url = $('#carousel-clip ul li:first a').attr('href').replace('#!/',''); $.address.path(url); } }).change(function(event) { if(event.pathNames[0]) { $.getJSON(location.pathname + 'image/' + event.pathNames[0] + '/', function(data, textStatus, XMLHttpRequest) { handler(data); }); } }); You can see it working here: http://bit.ly/cKftwA Thanks! Darren.

    Read the article

  • jQuery Autocomplete fetch and parse data source with custom function, except not

    - by Ben Dauphinee
    So, I am working with the jQuery Autocomplete function, and am trying to write a custom data parser. Not sure what I am doing incorrectly, but it throws an error on trying to call the autocompleteSourceParse function, saying that req is not set. setURL("ajax/clients/ac"); function autocompleteSourceParse(req, add){ var suggestions = []; $.getJSON(getURL()+"/"+req, function(data){ $.each(data, function(i, val){ suggestions.push(val.name); }); add(suggestions); }); return(suggestions); } $("#company").autocomplete({ source: autocompleteSourceParse(req, add), minLength: 2 });

    Read the article

  • jQuery plugin question - populate select options with JSON data

    - by user331884
    I'm trying to fill selects with json data from a web service. I'm getting error 'Object doesn't support this property or method.' when I do this $(this).html(options.join'')); Any ideas what I'm doing wrong? ;(function($) { $.fillSelect = {}; $.fn.fillSelect = function(url, map) { var jsonpUrl = url + "?callback=?"; $.getJSON(jsonpUrl, function(d) { var options = []; var txt = map[0]; var val = map[1]; options.push('<option>--Select--</option>'); $.each(d, function(index, item) { options.push('<option value="' + item[val] + '">' + item[txt] + '</option>'); }); $(this).html(options.join('')); //getting error Object doesn't support this property or method } }; })(jQuery);

    Read the article

  • jquery calling a function

    - by jay
    Hi, yet again thanks for looking. i like to call a function (eg. comment_disp, post_disp or any other i create later on). i have created a json function with url, fname and id can i use fname as a function name? // on document ready runs json('comments.php','comment_disp'); url = url to get fname = function name id = post or any other data id. json = function(url,fname,id){ $.getJSON(url,(fname)); } comment_disp = function(json){ }

    Read the article

  • Jquery ajax load of JSON in unit tests

    - by wmitchell
    I'm trying to load a dataset in jasmine for my tests like such ... However as its a json call I cant seem to always get the test denoted by "it" to wait till the JSON call has finished before using its array. I tried using the ajaxStop function to no avail. Any ideas ? describe("simple checks", function() { var exampleArray = new Array(); beforeEach(function(){ $(document).ajaxStop(function() { $(this).unbind("ajaxStop"); $.getJSON('/jasmine/obj.json', function(data) { $.each( json.jsonattr, function(i, widgetElement) { exampleArray.push(new widget(widgetElement)); }); }); }); }); it("use the exampleArray", function() { doSomething(exampleArray[0]); // frequently this is coming up as undefined });

    Read the article

  • Creating Dynamic variables from json response

    - by c0mrade
    My JSON response looks like this : {"sample":[{"id":"2","name":"branch name"},{"id":"3","name":"branch name 2"}]} My function looks like this : function getJSONObjects(){ $.getJSON("http://localhost/api/branches", function(data){ $.each(data.sample, function(i,item){ var loc = "branch"; eval("var " + loc + item.id + "=123;"); alert(loc + item.id); }); }); } The idea is to create branch + id object so I can do something with it(create marker on a map), so I tried to assign it any value to see if this was working. I wanted both branch2 and branch3 to alert 123 so I have something to start with. But currently this alerts branch2 and branch3 instead of 123. I have little experience with creating dynamic variables/objects can someone tell me what I'm doing wrong or maybe another approach towards solving this?

    Read the article

  • AJAX server calls on a JSF-centric app

    - by Konrad Garus
    I'm building a JSF 2 application. I wanted to integrate it with jQuery, e.g.: $.getJSON(contextPath + '/something', function(data) { // ... }); I need contextPath/something to return data in JSON. How can I do it? I know I can assign another servlet to this URL, but this approach does not seem to scale well. One could use a more scalable approach with a front end controller (e.g. Spring Web MVC), but I really wanted to write this in Java Enterprise stack. What other options are there?

    Read the article

  • gMaps suddenly stopped working : Can't find variable: G_NORMAL_MAP

    - by Luca
    hello! i inject a map on my div called "concessionario-map" with GMap, a jquery plugin. Gmap everything works fine until this morning. now the debugger says: ReferenceError: Can't find variable: G_NORMAL_MAP i just search on google and i read some similar situation, but i dont find a case like mine. please, can you help me? thanks a lot in advance :) (full code) $.getJSON("http://maps.google.com/maps/geo?q="+loc+"&key=ABQIAAAAgDXoBEgIn38xaRBBqo6ygxTDjF32IQ1zA0BVcGSuGouGRvo0kRRKiyipbCniJWSso2scatdz36K-Mg&sensor=false&output=json&callback=?",function(data, textStatus) { long = data.Placemark[0].Point.coordinates[0]; lat = data.Placemark[0].Point.coordinates[1]; console.log(data); $('#concessionario-map').gMap( { scrollwheel: false, latitude: lat, longitude: long, zoom: 15, markers: [{ latitude: lat, longitude: long }], icon: { image: "files/images/gmap_pin_orange.png", shadow: "files/images/gmap_pin_orange_shadow.png", iconsize: [26, 46], shadowsize: [28, 48], iconanchor: [12,46], infowindowanchor: [12, 0] } }) });

    Read the article

  • Encoding with url and api

    - by user2950824
    So I have this web app set up and running and it works fine for any username that you request, but when i try http://mrcastelo.pythonanywhere.com/lol/euw/Nazaré, it simply doesnt work - the error that I get on the server is the following: iddata= getJSON(urllolbase+region+urlid+username) #SummonerID UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 5: ordinal not in range(128) It is annoying me greatly, I've tried some other threads but none of them came to a fix. The api that I am using (www.legendaryapi.com) does accept this because this works. Any idea on how to fix this?

    Read the article

  • use JSON variable in jQuery dynamically

    - by user1644123
    I have two DIVs, #placeholder AND #imageLoad. When the user clicks on a particular thumb its larger version (thumb2) should then appear in #imageLoad DIV. Here is the jQuery that needs to be fixed: $.getJSON('jsonFile.json', function(data) { var output="<ul>"; for (var i in data.items) { output+="<li><img src=images/items/" + data.items[i].thumb + ".jpg></li>"; } output+="</ul>"; document.getElementById("placeholder").innerHTML=output; }); //This is wrong!! Not working.. $('li').on({ mouseenter: function() { document.getElementById("imageLoad").innerHTML="<img src=images/items/" + data.items[i].thumb2 + ".jpg>"; } }); Here is the external JSON file below (jsonFile.json): {"items":[ { "id":"1", "thumb":"01_sm", "thumb2":"01_md" }, { "id":"2", "thumb":"02_sm", "thumb2":"02_md" } ]}

    Read the article

  • 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

  • different markers on google maps v3

    - by user1447313
    i need help again :( How i can add different markers to google map v3. here is example for may marker var latlng = new google.maps.LatLng(lat,lng); var image = "../img/hotel_icon.png"; var locationDescription = this.locationDescription; var marker = new google.maps.Marker({ map: map, position: latlng, title:'pk:'+name, icon: image }); bounds.extend(latlng); setMarkes(map, marker, name, locationDescription); });//close each map.fitBounds(bounds); });//close getjson }//close initialize function setMarkes(map, marker, name, locationDescription){ google.maps.event.addListener(marker, 'mouseover', function() { infowindow.close(); infowindow.setContent('<h3>'+name+'</h3><em>'+locationDescription+'</em>'); infowindow.open(map, marker); }); } is any help

    Read the article

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