Search Results

Search found 17578 results on 704 pages for 'json framework'.

Page 24/704 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Benefit of outputting JSON as opposed to plain HTML

    - by Franco
    Hey guys, Just wondering which is best here. I want to output data from a table in my DB then put a lot of this data into a html table on the fly on my page. Im working with Java on the server side. Basically I pull the results form the DB and have the raw data..just what next? There is a chance I may want to take data from multiple tables in order to combine it into one table for my site. I retrieve the results of the query from the DB, now do i create a text from it in the form of json which i can parse as json using jquery upon the return of the object to my browser?(kind of a sub question of this question: Is just using a stringbuilder the correct way to make a json object to output?) Or.. Should i build the HTML as a string and output that to the browser instead? Which is better and why? Thanks in advance!

    Read the article

  • IE7 not digesting JSON: "parse error"

    - by Kenny Leu
    While trying to GET a JSON, my callback function is NOT firing. $.ajax({ type:"GET", dataType:'json', url: myLocalURL, data: myData, success: function(returned_data){alert('success');} }); The strangest part of this is that my JSON(s) validates on JSONlint this ONLY fails on IE7...it works in Safari, Chrome, and all versions of Firefox. If I use 'error', then it reports "parseError"...even though it validates! Is there anything that I'm missing? Does IE7 not process certain characters, data structures (my data doesn't have anything non-alphanumeric, but it DOES have nested JSONs)? I have used tons of other AJAX calls that all work (even in IE7), but with the exception of THIS call. An example data return here is: {"question":{ "question_id":"19", "question_text":"testing", "other_crap":"none" }, "timestamp":{ "response":"answer", "response_text":"the text here" } } I am completely at a loss. Hopefully someone has some insight into what's going on...thank you!

    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

  • GQL: I'm storing JSON in the DataStore. All json is getting converted to html entities, how to avoid

    - by fmsf
    The tittle says most: I'm storing JSON in the DataStore. All json is getting converted to html entities, how can I avoid this? Original I had myJson = db.StringProperty() it complained the json i had was to long and StringProperty had a limit of around 500 chars. Sugesting to use TextProperty instead. It inserted without problems but now myJson looks like this when i fetch it from the database: { &quot;timeUnit&quot;: &quot;14&quot;, &quot;taskCounter&quot;: &quot;0&quot;, &quot;dependencyCounter&quot;: &quot;0&quot;, &quot;tasks&quot;: [], &quot;dependencies&quot;: []} Any sugestions?

    Read the article

  • How to pass json via a form element

    - by becomingGuru
    I have this swf (flash) file that provides the json that needs to be sent to the server. I wrote a very simple jQuery: function submitForm(swf_json) { $('#swfjson').val(swf_json); #swfjson is an input of type hidden $('#titleForm').submit(); } and the swf will call the submitForm above and I receive the request.POST in django as usual. But, django is interpreting the swf_json as a string "Object object" >>>type(request.POST['swfjson']) <type 'unicode'> Of course I can pass the json as a string to the view function. Doesn't seem good to me. Any other way of passing the json object to the django view?

    Read the article

  • Json / Jsonp not connecting to php (Phonegap + jquerymobile)

    - by Madhulika Mukherjee
    I am trying to make - an android WEB application with phonegap layout with JqueryMobile What Im doing - An html form that takes ID, name, and address as input 'Serialize's this data using ajax makes a json object out of it Should send it to a file called 'connection.php' Where, this data is put into a database (MySql) Other details - My server is localhost, Im using xampp I have already created a database and table using phpmyadmin The problem - My html file, where my json object is created, does not connect to the php file which is hosted by my localhost Here is my COMPLETE html file: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <!-- Change this if you want to allow scaling --> <meta name="viewport" content="width=default-width; user-scalable=no" /> <meta http-equiv="Content-type" content="text/html;charset=utf-8"> <title>Trial app</title> <link rel="stylesheet" href="thestylesheet.css" type="text/css"> <script type="text/javascript" charset="utf-8" src="javascript1.js"></script> <script type="text/javascript" charset="utf-8" src="javascript2.js"></script> <script type="text/javascript" charset="utf-8" src="cordova-1.8.0.js"></script> <script> $(document).ready(function () { $("#btn").click( function() { alert('hello hello'); $.ajax({ url: "connection.php", type: "POST", data: { id: $('#id').val(), name: $('#name').val(), Address: $('#Address').val() }, datatype: "json", success: function (status) { if (status.success == false) { alert("Failure!"); } else { alert("Success!"); } } }); }); }); </script> </head> <body> <div data-role="header"> <h1>Heading of the app</h1> </div><!-- /header --> <div data-role="content"> <form id="target" method="post"> <label for="id"> <input type="text" id="id" placeholder="ID"> </label> <label for="name"> <input type="text" id="name" placeholder="Name"> </label> <label for="Address"> <input type="text" id="Address" placeholder="Address"> </label> <div id="btn" data-role="button" data-icon="star" data-theme="e">Add record</div> <!--<input type="submit" value="Add record" data-icon="star" data-theme="e"> --> </form> </div> </body> </html> And here is my 'connection.php' hosted by my localhost <?php header('Content-type: application/json'); $server = "localhost"; $username = "root"; $password = ""; $database = "jqueryex"; $con = mysql_connect($server, $username, $password); if($con) { echo "Connected to database!"; } else { echo "Could not connect!"; } //or die ("Could not connect: " . mysql_error()); mysql_select_db($database, $con); /* CREATE TABLE `sample` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(45) DEFAULT NULL, `Address` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) ) */ $id= json_decode($_POST['id']); $name = json_decode($_POST['name']); $Address = json_decode($_POST['Address']); $sql = "INSERT INTO sample (id, name, Address) "; $sql .= "VALUES ($id, '$name', '$Address')"; if (!mysql_query($sql, $con)) { die('Error: ' . mysql_error()); } else { echo "Comment added"; } mysql_close($con); ?> My doubts: No entry is made in my table 'sample' when i view it in phpmyadmin So obviously, i see no success messages either I dont get any errors, not from ajax and neither from the php file. Stuff Im suspecting: Should i be using jsonp instead of json? Im new to this. Is there a problem with my php file? Perhaps I need to include some more javascript files in my html file? I assume this is a very simple problem so please help me out! I think there is just some conceptual error, as i have only just started with jquery, ajax, and json. Thank you.

    Read the article

  • Sinatra, JavaScript Cross-Domain Requests JSON

    - by pex
    I run a REST-API build on top of Sinatra. Now I want to write a jQuery Script that fetches data from the API. Sinatra is told to response with JSON before do content_type :json end A simple Route looks like get '/posts' do Post.find.to_json end My jQuery script is a simple ajax-call $.ajax({ type: 'get', url: 'http://api.com/posts', dataType: 'json', success: function(data) { // do something } }) Actually everything works fine as long as both runs on the same IP, API and requesting JS. I already tried to play around with JSONP for Rack without any positive results, though. Probably I just need a hint how to proceed.

    Read the article

  • YUI Datatable Not Taking JSON

    - by Pete Herbert Penito
    I am trying to fill a Datatable with a JSON using YUI, I have this JSON: [{"test":"value1", "test2":"value2", "test3":"value3", "topic_id":"123139007E57", "gmt_timestamp":1553994442, "timestamp_diff":-1292784933382, "status":"images\/statusUp.png", "device_id":"568FDE9CC7275FA"}, .. It continues like this with about 20 different devices, and I close it with a ] I just want to print select keys in the datatable so my Column Definitions look like this: var myColumnDefs = [ {key:"test", sortable:true, resizeable:true}, {key:"test2", sortable:true, resizeable:true}, {key:"topic_id", sortable:true, resizeable:true}, {key:"status", sortable:true, resizeable:true}, {key:"device_id", sortable:true, resizeable:true}, ]; var myDataSource = new YAHOO.util.DataSource(bookorders); myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY; myDataSource.responseSchema = { fields: ["test","test2","topic_id","status","device_id"] }; var myDataTable = new YAHOO.widget.DataTable("basic", myColumnDefs, myDataSource); It's print Data Error for some reason, what am I doing wrong? Thanks! I have tested the validity of the JSON at JSONLint and it says it is valid.

    Read the article

  • relace double quotes to parse JSON in PHP

    - by hunt
    hi, i have following json format { "status": "ACTIVE", "result": false, "isworking": false, "margin": 1, "employee": { "111": { "val1": 5.7000000000000002, "val2": "9/2", "val3": 5.7000000000000002 }, "222": { "val1": 31.550000000000001, "val2": "29/1", "val3": 31.550000000000001 } } } how the problem is when i am trying to decode above json response in php using json_decode($res,true) { true param for associative array } i am getting following result as few fields like "result":false is not "result":"false" i.e. at many of the places doubles quotes are missing in values of json. see in val1 and val3 fields resultant data after decoding in php (associative array) Array ( [status] = ACTIVE [result] = [isworking] = [margin] = 1 [employee] = Array ( [111] = Array ( [val1] = 5.7 [val2] = 9/2 [val3] = 5.7 ) [222] = Array ( [val1] = 31.55 [val2] = 29/1 [val3] = 31.55 ) ) ) please help me on how would i insert double quotes in values ? Thanks

    Read the article

  • Help with IE bugs when writing JSON via an ASPX response

    - by Jereme
    I have an ASPX page that I am using to write JSON. It works great in Firefox and Chrome, but when I try and use it in IE 8 it gives me an "The XML page cannot be displayed" error instead of allowing jQuery to load the JSON being written by the response. Any ideas? Here is what my code looks like: protected override void OnLoad(EventArgs e) { Response.Clear(); Response.ClearHeaders(); Response.ContentType = "application/json"; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Write(string.Format("[ {{ \"Foo\": \"{0}\", \"bar\": \"{1}\" }} ]", "Foo Content", "Bar Content")); Response.End(); }

    Read the article

  • Backbone.js - Getting JSON back from url

    - by Brian
    While trying to learn Backbone.js, I've been trying to grab the content of a JSON file using the following code: (function($){ var MyModel = Backbone.Model.extend(); var MyCollection = Backbone.Collection.extend({ model : MyModel, url: '/backbone/data.json', parse: function(response) { console.log(response); return response; } }); var stuff = new MyCollection; console.log(stuff.fetch()); console.log(stuff.toJSON()); })(jQuery) 'stuff.fetch()' returns the entire object (with the data I'm after in responseText), 'stuff.toJSON' returns nothing ([]), but the console in the parse method is returning exactly what I want (the json object of my data). I feel like I'm missing something obvious here, but I just can't seem to figure it out why I can't get the right data out. Could someone point me in the right direction or show me what I'm doing wrong here? Am I using a model for the wrong thing?

    Read the article

  • Performance problems when loading local JSON via <script> elements in IE8

    - by Jens Bannmann
    I have a web page with some JS scripts that needs to work locally, e.g. from hard disk or a CD-ROM. The scripts load JSON data from files by inserting <script> tags. This worked fine in IE6, but now in IE8 it takes an enormous amount of time: it went from "instantly" to 3-10 seconds. The main data file is 45KB large. How can I solve this? I would switch from <script> tags to another method of loading JSON (ideally involving the new native JSON parser), but it seems locally loaded content cannot access the XMLHttpRequest object. Any ideas?

    Read the article

  • how to use proxy with JSON

    - by Dele
    I have a php page called 'dataFetch.php' which sits on one webserver. On another webserver, I have a JS file which issues JSON calls to dataFetch. dataFetch connects to a database, retrieves data and puts it in a JSON format which is fed back to the calling program. In IE, this works fine. In other browsers it does not because of the cross domain restriction. To get across the cross-domain restriction, I make a call to a file, proxy.php, which then makes the call to dataFetch. My problem now is that proxy.php retrieves the file from dataFetch but the JS script file no longer sees the response from proxy.php as a JSON format and so I can't process it. Can anybody help me out?

    Read the article

  • Rails: include related object in JSON output

    - by Codezy
    I have a note class that belongs to a user (ie a user can create many notes). clip from my notes controller class NotesController < ApplicationController before_filter :authenticate_user! respond_to :html, :xml, :json # GET /notes # GET /notes.xml def index @notes = Note.includes(:user).order("created_at DESC") respond_with @notes end When I ask for the index in json results for example /notes.json, it returns the notes but only returns user_id for the user object. I would like it to also include user.username (and would be curious how to have the whole user object embedded). Bonus question: I could not find a way to make the column show as author_id and have it relate back to user. If this is easy to do, how do you do it?

    Read the article

  • how to manipulate Json response like an object?

    - by loviji
    Hello, my jQuery.ajax return JSon object. I firstly read other articles. but their response text not likes mine. My Response content: from firebug response {"item":"[{\"country\":\"USA\",\"lan\":\"EN\"},{\"country\":\"Turkiye\",\"lan\":\"TR\"}]"} Now i trying to alert countryName: $('#loadData').click(function() { $.ajax({ type: "POST", url: "WS/myWS.asmx/getDaa", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { $("#jsonResponse").html(msg); $.each(msg.item, function(i, d) { alert(this.country); debugger; }); }, }); }); but it is alerting "undefined"

    Read the article

  • JSON from jQuery to PHP

    - by enfix
    I need to pass a JSON object from $.post() jQuery function to PHP page. I tried this plugin jquery-json, but don't work: //include jquery.js and jquery.json.js $(document).ready(function(){ var data = new Object(); data.hello = "Hello"; data.world = "World"; var datajson = $.toJSON(data); $.post('file.php', {data: datajson}, function(res){ alert(res); }); }); And file.php has this simple line: <? var_dump(son_decode($_REQUEST['data'], true)); ?> What's the problem ?

    Read the article

  • Rails rabl json format

    - by brabertaser1992
    I'm displaying data from my db in json format using rabl to parse it for android... My json looks like so: [ { "bank":{ "central_office_address":"ololo", "license":"12312312", "location_id":3, "name":"Pbank", "tax_number":"12312312", "year_of_foundation":1987 } }, { "bank":{ "central_office_address":"sdfsdf sdf", "license":"321312", "location_id":3, "name":"Bbank", "tax_number":"321321", "year_of_foundation":1999 } } ] I need my json in a format like: { "contacts": [ { "id": "c200", "name": "Ravi Tamada", "email": "[email protected]", "address": "xx-xx-xxxx,x - street, x - country", "gender" : "male", "phone": { "mobile": "+91 0000000000", "home": "00 000000", "office": "00 000000" } }, { "id": "c201", "name": "Johnny Depp", "email": "[email protected]", "address": "xx-xx-xxxx,x - street, x - country", "gender" : "male", "phone": { "mobile": "+91 0000000000", "home": "00 000000", "office": "00 000000" } } ] } Such data is normally parsed in java.... My rabl view: object @banks attributes :central_office_address, :license, :location_id, :name, :tax_number, :year_of_foundation How do I change its output to match the second example?

    Read the article

  • Is it possible to access JSON properties with relative syntax when using JSON defined functions?

    - by Justin Vincent
    // JavaScript JSON var myCode = { message : "Hello World", helloWorld : function() { alert(this.message); } }; myCode.helloWorld(); The above JavaScript code will alert 'undefined'. To make it work for real the code would need to look like the following... (note the literal path to myCode.message) // JavaScript JSON var myCode = { message : "Hello World", helloWorld : function() { alert(myCode.message); } }; myCode.helloWorld(); My question is... if I declare functions using json in this way, is there some "relative" way to get access to myCode.message or is it only possible to do so using the literal namespace path myCode.message?

    Read the article

  • C# DataTable to Json?

    - by AliRiza Adiyahsi
    I want to get DataTable as Json Format to show it on a chart. public JsonResult GetDataTable() { DataTable dt = new DataTable(); dt.Columns.Add("Jan"); dt.Columns.Add("Feb"); dt.Columns.Add("Mar"); dt.Columns.Add("Apr"); for (int i = 0; i < 10; i++) { dt.Rows.Add(i * 5, i * 10, i * 15, i * 11); } // JsonDataTable = dt to Json return new JsonResult { Data = new { success = true, chartData = JsonDataTable }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } How Can I convert DataTable to Json? Thanks.

    Read the article

  • Serialising my JSON output problem in JQuery

    - by davykiash
    Am trying to validate my form using an AJAX call $("#button").click(function() { $.ajax({ type: "POST", url: "<?php echo $this->baseUrl() ?>/expensetypes/async", data: 'fs=' + JSON.stringify($('#myform').serialize(true)), contentType: "application/json; charset=utf-8", dataType: "json" }); }); On my controller my code is as follows //Map the form from the client-side call $myFormData = Zend_Json::decode($this->getRequest()->getParam("fs") ,Zend_Json::TYPE_ARRAY); $form = new Form_Expensetypes(); $form->isValid($myFormData); However from firebug my output is as follows fs="id=&expense_types_code=AAA&expense_types_desc=CCCC&expense_types_linkemail=XXXX&expense_types_budgetamount=22222&expense_types_budgetperiod=22222" What I expect is something similar to fs{"expense_types_code":"AAA","expense_types_desc":"CCCC","expense_types_linkemail":"XXXX","expense_types_budgetamount":"22222"} How do I achieve this type of serialisation?

    Read the article

  • Reading JSON string in Jquery

    - by Bala
    Hi All When i try to read a JSON string like below it goes to endless loop. <script language="javascript"> $(document).ready(function() { $("#Button1").click(function() { var json = "[{'City':'Lucknow','ID':'1'},{'City':'Mumbai','ID':'2'}]"; $.each(json, function() { alert(this['City']); }); }); </script> Not sure what i am doing wrong? Please helpme out!

    Read the article

  • Serializing to JSON in jQuery

    - by Herb Caudill
    I know how to serialize an object to JSON in ASP.NET Ajax, but I'm trying to do things on the client in a less Microsoft-specific way. I'm using jQuery. Is there a "standard" way to do this? My specific situation: I have an array defined something like this: var countries = new Array(); countries[0] = 'ga'; countries[1] = 'cd'; ... and I need to turn this into a string to pass to $.ajax() like this: $.ajax({ type: "POST", url: "Concessions.aspx/GetConcessions", data: "{'countries':['ga','cd']}", ... Edit (clarification) I realize there are a number of JSON libraries out there, but I'd like to avoid introducing a new dependency (if I'm going to do that, I might as well use ASP.NET Ajax's built-in JSON serializer).

    Read the article

  • JSON + PHP + JQuery + Autocomplete problem...

    - by RohanCS
    Hi Everyone, Only started today but I'm having massive problems trying to understand JSON/AJAX etc, I've gotten my code this far but am stumped on how to return the data being pulled by the AJAX request to the jQuery Auto complete function. var autocomplete = new function (){ this.init = function() { $('#insurance_destination').autocomplete({source: lookup}); } function lookup(){ $.ajax({ url: "scripts/php/autocomplete.php", data: {query:this.term}, dataType: "json", cache : false, success: function(data) { for(key in data){ return { label: key, value: data[key][0] } } } }); } } And example of the JSON string being returned by a PHP script {"Uganda":["UGA","UK4","Worldwide excluding USA, Canada and the Carribbean"]}

    Read the article

  • Reorganized JSON

    - by couatl
    Need to be reorganized JSON into a new structure. Python. for example { 'a' : 1, 'b' : 1, 'd' : {'d1' : '1', 'd2' : 2}, 'm' : [ {'x' : 6, 'y' : 5, 'z' : {'foo' : 'foo1', 'bar : 'bar1'} }, {'x' : 8, 'y' : 8, 'z' : {'foo' : 'foo2', 'bar : 'bar2'} } ... ] } to { 'new_a' : 1, 'new_d' : {'new_d1' : '1', 'new_d2' : 2}, 'new_m' : [ {'new_x' : 6, 'new_z' : {'new_foo' : 'foo1', new_'bar : 'bar1'} }, {'new_x' : 8, 'new_z' : {'new_foo' : 'foo2', 'new_bar : 'bar2'} } ... ] } There is the idea of ??a new form of an old JSON Is there a more elegant way of that? import json new_data = {} new_data['new_a'] = old_data['a'] new_data['new_d'] = {} new_data['new_d']['new_d1'] = old_data['d']['d1'] new_data['new_d']['new_d2'] = old_data['d']['d2'] new_data['new_m'] = {} new_m = [] for m in old_data: new_m.append({'new_x' : m['x'], 'new_z' : {'new_foo' ....

    Read the article

  • .NET Framework installation requirements

    - by Paja
    What are the requirements for all .NET frameworks and their service packs? This is what I need to know for all available frameworks: .NET Framework prerequisites What other .NET Frameworks does it require? For example: .NET Framework 2.0 does not require anything, .NET Framework 2.0 SP1 requires .NET Framework 2.0 installed, but .NET Framework 3.5 SP1 does not require .NET Framework 3.5 installed (or maybe does? dunno) Reboot requirements Does the installation package require reboot after installation? Clean install requirements Does the installation package require clean install? (No pending delete/rename operations) Administrator privileges Does the installation package require administrator privileges to install? (I guess this is "yes" for all of them...) And I need to know all of this for the following packages: .NET Framework 1.1 .NET Framework 1.1 Language Pack .NET Framework 1.1 SP 1 .NET Framework 2.0 .NET Framework 2.0 Language Pack .NET Framework 2.0 SP 1 .NET Framework 2.0 SP 1 Language Pack .NET Framework 2.0 SP 2 .NET Framework 2.0 SP 2 Language Pack .NET Framework 3.5 .NET Framework 3.5 Language Pack .NET Framework 3.5 SP 1 .NET Framework 3.5 SP 1 Language Pack .NET Framework 4.0 Full .NET Framework 4.0 Client Could you please either tell me all of these requirements, or direct me to the appropriate source? Or maybe both? :-)

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >