Jump to content

Search the Community

Showing results for tags 'json'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

  1. Currently I'm learning Ajax with Java.The innerHTML method works when I'm retrieving simple string data from the servlet, and when I need to update only one HTML element.Since I have the need to update more HTML elements it occurred to me that I can use JSON object with several properties (HTML tag data for each element needed updating).After trying that I've noticed that innerHTML method doesn't work, when I try to process the retrieved data in the Callback function.My question is, why is this happening?Did someone had a similar problem when using JSON with Javascript.Just for the record, when I use innerText method I successfully update the HTML elements with JSON properties data, only they update as text and that's what I don't need. (See the video) Thank You.
  2. Hey Everyone! i want to convert my HTML form data to JSON and send that JSON to a PHP page on server. How can i do that. My HTML form is like this.. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title></head><body id="top"><p>Enter Products</p><form id="form1" name="form1" method="post" action="create_product.php"> <p>Name <input type="text" name="name" id="name" /> </p> <p>Description <input type="text" name="desc" id="desc" /> </p> <p>Short Description <input type="text" name="short_desc" id="short_desc" /> </p> <p>Weight <input type="text" name="weight" id="weight" /> </p> <p>Price <input type="text" name="price" id="price" /> </p> <p>SKU <input type="text" name="sku" id="sku" /> </p> <p>Category <select id="userdata" name="category"> <option>Choose</option> </select> </p> <p>Promotion <select name="promotion"> <option value="1">Yes</option> <option value="0">No</option> </select></p> <p> <br> <label for="image"><span class="style1">Enter Image</span></label><br> <input type="file" name="uploaded" id="uploaded" /> </br></br> </p> <p>Submit <input type="submit" name="button" id="button" value="Submit" /> </p></form><p>*SKU must be unique</p></body></html> Please help me..
  3. Hey Everyone! i have generated JSON from HTML form data, now i want to send that JSON to a PHP page. I have written this javascript. var jsondata;$.fn.serializeObject = function(){ var o = {}; var a = this.serializeArray(); $.each(a, function() { if (o[this.name] !== undefined) { if (!o[this.name].push) { o[this.name] = [o[this.name]]; } o[this.name].push(this.value || ''); } else { o[this.name] = this.value || ''; } }); return o;};$(function() { $('form').submit(function() { jsondata = $('#result').text(JSON.stringify($('form').serializeObject())); return false;});}) Please help me i am new to this..
  4. Hey everyone! i am creating a dynamic drop down menu in html, but the values are not coming in the drop down, it shows an empty menu. I am calling the PHP file which is echoing JSON of the data. here is the Javascript code.. $(function(){var serviceURL = "http://localhost/mano-2/";var get = ''; get = 'echo_cat.php'; var items=""; $.getJSON(serviceURL + get , function(data){ $.each(data,function(index,item) { items = items + "<option value='"+item.entity_id+"'>"+item.name+"</option>" ; }); $("#a1_title").html(items); });}); the JSON is like this {"items":[{"entity_id":"1","name":"Root Catalog"},{"entity_id":"2","name":"Default Category"}]} the HTML code is like this <select id="a1_title"> <option>Default</option></select> Please help me..
  5. I need help getting a value from a rather complicated JSON string. I am using eval() in a javascript function called json and then doing the following on a classic ASP page: X = {"status": "ok","error": [],"method": "get_metadata","result": [{"metadata": {"med": {"action": "search", "": "0", "type": "int"},"F206": {"action": "search", "": "0", "type": "int"},"sty": {"action": "search", "": "3", "type": "int"},"F701": {"action": "search", "": "0", "type": "int"},"rtl": {"action": "mixed", "": "41.98", "type": "float"},"hev": {"action": "search", "": "0", "type": "int"},"use": {"action": "search", "": "2", "type": "int"},"rank": {"action": "mixed", "": "0.1428", "type": "float"},"dsc": {"action": "mixed", "": "ICON 4 NAVY", "type": "string"},"avl": {"action": "search", "": "46.05", "type": "float"},"whs": {"action": "mixed", "": "20.99", "type": "float"},"phs": {"action": "mixed", "": "1", "type": "int"},"ufac": {"action": "search", "": "0", "type": "int"},"dt": {"action": "mixed", "": "14701", "type": "int"},"con": {"action": "search", "": "28", "type": "int"},"cabu": {"action": "search", "": "0", "type": "int"},"col": {"action": "mixed", "": "300", "type": "int"},"out": {"action": "search", "": "0", "type": "int"}},"filepath": "ICON-4.jpg"}]} dim Meta : set Meta = json(X) 'this is done serverside I am looking to get the value for 'sty' which should be '3'. I can't wrap my head around it in ASP (and yes it has to be done in ASP) thanks
  6. <html><!--php_json.php--><head><script src="json2.js"></script><script src="php.js"></script><script>ajax("php_json.json",function(){oJSON = JSON.parse(xmlhttp.responseText);sJSON = JSON.stringify(oJSON);/*put it hereokay*/});// here, the variable sJSON is undefinedajax("php.php?json="+sJSON,function(){ alert(xmlhttp.responseText); });//</script></head><body></body></html> // php.jsfunction ajax(source,func){xmlhttp = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP") ? new ActiveXObject("Msxml2.XMLHTTP") : null ;xmlhttp.onreadystatechange = function(){ (xmlhttp.readyState == 4 && xmlhttp.status == 200) ? func() : null ; }xmlhttp.open("GET",source,true);xmlhttp.send();} wanna ask how to extend the scope of the variable sJSON to be global?
  7. var ajax = function(query){xmlhttp = (window.XMLHttpRequest) ? xmlhttp=new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP") ? new ActiveXObject("Msxml2.XMLHTTP") : null ;xmlhttp.onreadystatechange = function(){ jsonData = JSON.parse(xmlhttp.responseText); (xmlhttp.readyState==4 && xmlhttp.status==200) ? func(query) : null ; }xmlhttp.open("GET","lib.json",true);xmlhttp.send();} function func(query){ // fail to check an undefined AJAX responseTextif(typeof(xmlhttp.responseText)=="undefined" && xmlhttp.responseText != null){ alert(0); }else { document.getElementById("result").innerHTML = jsonData[1][query]; }} This is the testing page:http://lifelearning.xtreemhost.com/lib.html Just wanna ask how to check an undefined AJAX responseText.Many thanks.
  8. Need an xslt to convert xml into json.I have a xml file which is having 3 attributes.The value in the 3rd attribute is another xml file.I need an xslt which can read the value of the 3rd attribute as another xml (not just a value) and can convert it into json format. <?xml version="1.0"?> <ResultSet> <attribute1>123</attribute1> <attribute2>456</attribute2> <attribute3> <?xml version="1.0"?> // Need this xml (i.e. value of third attribute) to be converted into Json <NewResultSet> <rowset> <node1>111</node1> <node2>222</node2> </rowset> <rowset> <node1>333</node1> <node2>444</node2> </rowset> </NewResultSet> </attribute3> </ResultSet>
  9. I have some data in a flat file. These are the fields: nameaddressziplatlng A row of data might look something like: fishing hole #1, Catalina Island U.S., 90704, 33.3, 118.4 There are fifty rows of data. I am trying with PHP to encode this data into an XML file. The ultimate goal is that the data will be stored on the disk in XML format and when requested PHP will read the XML file and retrieve the data and put it into an array so I can encode the data in JSON and send it back off to JavaScript (AJAX). I'm very familiar with working with flat files and SQL however XML is a bit unfamiliar to me as of yet. How would this be accomplished? Good Evening W3Schools!
  10. ibrahimjan

    CONCAT sql

    Hi All, I got this sql connection to my table wb, it all seems to work fine in phpmyadmin, when testing sql, but when i want to us it, it comes up with: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING inC:\----------\test3.php on line 75 line 75 is the $query_wb $query_wb = "SELECT CONCAT( "[", GROUP_CONCAT( CONCAT("{weID:'",`weID`,"'"), CONCAT(",weName:'",`weName`,"'}") ) ,"]") AS json FROM wb;"; any Ideas how to make it work??
×
×
  • Create New...