Search the Community

Showing results for tags 'json'.



More search options

  • 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

Calendars

  • Community Calendar

Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 31 results

  1. Hello, I want to do a countdown and put it in my website. I did a countdown but I have a problem, when I launch it, the seconds are freezing they are not anymore running... So the countdown is not in realtime anymore... I have to refresh in order to see the countdown running. Here is what I did: <div id="after"> <span id="dhour"></span>:<span id="dmin"></span>:<span id="dsec"></span> </div> <div id="count2">Texte à afficher</div> <div class="numbers" id="dday" hidden="true"></div> <script> var ladate = new Date("<?php echo gmdate("Y-m-d\TH:i:s\Z");?>"); var year=ladate.getFullYear(); var month=ladate.getMonth()+1; var day=ladate.getDate(); var hour=14; var minute=20; var tz=0; var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); function countdown(yr,m,d,hr,min){ theyear=yr;themonth=m;theday=d;thehour=hr;theminute=min; var today= new Date("<?php echo gmdate("Y-m-d\TH:i:s\Z");?>"); var todayy=today.getYear(); if (todayy < 1000) {todayy+=1900; } var todaym=today.getMonth(); var todayd=today.getDate(); var todayh=today.getHours(); var todaymin=today.getMinutes(); var todaysec=today.getSeconds(); var todaystring1=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec; var todaystring=Date.parse(todaystring1)+(tz*1000*60*60); var futurestring1=(montharray[m-1]+" "+d+", "+yr+" "+hr+":"+min); var futurestring=Date.parse(futurestring1)-(today.getTimezoneOffset()*(1000*60)); var dd=futurestring-todaystring; var dday=Math.floor(dd/(60*60*1000*24)*1); var dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1); var dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1); var dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1); if(dday<=0&&dhour<=0&&dmin<=0&&dsec<=0){ document.getElementById('count2').style.display="inline"; document.getElementById('after').style.display="none"; document.getElementById('dday').style.display="none"; document.getElementById('dhour').style.display="none"; document.getElementById('dmin').style.display="none"; document.getElementById('dsec').style.display="none"; document.getElementById('days').style.display="none"; document.getElementById('hours').style.display="none"; document.getElementById('minutes').style.display="none"; document.getElementById('seconds').style.display="none"; return;}else { document.getElementById('count2').style.display="none"; document.getElementById('dday').innerHTML=dday; document.getElementById('dhour').innerHTML=dhour; document.getElementById('dmin').innerHTML=dmin; document.getElementById('dsec').innerHTML=dsec; window.location.reload(); setTimeout("countdown(theyear,themonth,theday,thehour,theminute)",1000);}} countdown(year,month,day,hour,minute); </script> Thank you.
  2. consider this is my json array [ {"products":[{"productname":"Online Test","product":[{"subjectname":"Quants","lessonid":"16","subjectid":null,"subject_covered":"Algebra for SSC","lesson":"15","videoflag":false,"videos":null,"quiz":[{"practice":[{"title":"15.0 - Test of Quantitative Aptitude: Algebra for SSC : Lesson 15.0 ","nid":"21712","quizid":null}],"combo":null,"mock":null}],"ebook":null},{"subjectname":"Quants","lessonid":"17","subjectid":null,"subject_covered":"Trigonometry for SSC","lesson":"16","videoflag":false,"videos":[],"quiz":[{"practice":[{"title":"16.0- Test of Quantitative Aptitude: Trigonometry for SSC : Lesson 16.0 ","nid":"21816","quizid":null}],"combo":[],"mock":[]}],"ebook":null},{"subjectname":"Quants","lessonid":"18","subjectid":null,"subject_covered":"Mensuration for SSC","lesson":"17","videoflag":false,"videos":[],"quiz":[{"practice":[{"title":"17.0- Test of Quantitative Aptitude: Mensuration for SSC : Lesson 17.0 ","nid":"21675","quizid":null}],"combo":[],"mock":[]}],"ebook":null},{"subjectname":"Quants","lessonid":"19","subjectid":null,"subject_covered":"Geometry for SSC","lesson":"18","videoflag":false,"videos":[],"quiz":[{"practice":[{"title":"18.0 -Test of Quantitative Aptitude: Geometry for SSC : Lesson 18.0 ","nid":"21740","quizid":null}],"combo":[],"mock":[]}],"ebook":null},{"subjectname":"GK","lessonid":"02","subjectid":null,"subject_covered":"Test of SSC GK Question","lesson":"2","videoflag":false,"videos":[] and i want to print the product array and print the subject name as well as quiz array title in a web page... how to parse the json and display these results in html page? please help me thanks in advance
  3. Hi, I'm trying to follow the JSON example at http://www.w3schools.com/json/json_example.asp I have adjusted the code a little but the code is as follows: jsonTest.html <!DOCTYPE html> <html> <head> <style> h1 { border-bottom: 3px solid #cc9900; color: #996600; font-size: 30px; } table, th , td { border: 1px solid grey; border-collapse: collapse; padding: 5px; } table tr:nth-child(odd) { background-color: #f1f1f1; } table tr:nth-child(even) { background-color: #ffffff; } </style> </head> <body> <h1>Customers</h1> <div id="id01"></div> <script> var xmlhttp = new XMLHttpRequest(); var url = 'jsonTestPHP.php'; xmlhttp.onreadystatechange=function() { if (this.readyState == 4 && this.status == 200) { myFunction(this.responseText); } } xmlhttp.open("GET", url, true); xmlhttp.send(); function myFunction(response) { var arr = JSON.parse(response); var i; var out = "<table>"; for(i = 0; i < arr.length; i++) { out += "<tr><td>" + arr.Name + "</td><td>" + arr.Bedrooms + "</td><td>" + arr.Length + "</td></tr>"; } out += "</table>"; document.getElementById("id01").innerHTML = out; } </script> </body> </html> jsonTest.php <?php header("Access-Control-Allow-Origin: *"); header("Content-Type: application/json; charset=UTF-8"); require_once 'login.php'; $conn = new mysqli($hn, $un, $pw, $db); if ($conn->connect_error) die($conn->connect_error); $result = $conn->query("SELECT name, bedrooms, length FROM holidyhomes"); $outp = "["; while($rs = $result->fetch_array(MYSQLI_ASSOC)) { if ($outp != "[") {$outp .= ",";} $outp .= '{"Name":"' . $rs["name"] . '",'; $outp .= '"Bedrooms":"' . $rs["bedrooms"] . '",'; $outp .= '"Length":"'. $rs["length"] . '"}'; } $outp .="]"; $conn->close(); echo($outp); ?> So I have changed the var url = "http://www.w3schools.com/website/customers_mysql.php"; from the jsonTest.html to var url = 'jsonTestPHP.php'; When I run this I get "Invalid character: var arr = JSON.parse(response);" I just want to be able to grab the data from my database and display it on screen using JSON. Can anyone help me understand why I'm getting this Invalid character error or tell me if I'm going about this the totally wrong way? Thanks
  4. Hello All, I am stuck trying to filter results of a json response. I have a sample json response: [ { "id":0, "commentText":"Test", "createdBy":"User1", "isImportant":false }, { "id":1, "commentText":"Hello World", "createdBy":"User2", "isImportant":true }, { "id":2, "commentText":"Testing", "createdBy":"User2", "isImportant":false }, { "id":3, "commentText":"This is another one", "createdBy":"User2", "isImportant":true }, { "id":4, "commentText":"Hello World!", "createdBy":"User2", "isImportant":true } ] I am attempting to filter out results that "isImportant" are not true. I have tried multiple ways of doing it with no luck. IE. var response = $(jsonSample).filter(function (i,n){ return n.isImportant===true }); var response2 = $.grep(Object(jsonSample), function(j){ return j.isImportant !== false; }); var response3 = $.map(jsonSample, function (n,i){ $.each(n, function(j){ return n.isImportant !== false; }) }); console.log(response); //jquery-2.2.4.min.js:2 Uncaught Error: Syntax error, unrecognized expression: ... console.log(response2); //logs every individual character in the jsonSample ["[", "{", """, "i", "d", """, ":", "1", ... console.log(response3); //jquery-2.2.4.min.js:2 Uncaught TypeError: Cannot use 'in' operator to search for 'length' in ...
  5. I made an ajax call in my project, the call return a json object, i can see the json object in my console but when ever i call the w3DisplayDate() I get this error in my console " w3data.js:30 Uncaught TypeError: Cannot read property 'insertBefore' of null ". Is this a bug or am I doing something wrong, someone please help.
  6. im trying to output a json file to an expandable tree using html and jquery. its working, but the nesting and nodes within the tree are misplaced. any idea what that is? for example. mainstation 2 is coming out as a child of mainstation 1, while they should be siblings. it should be a logic error html code:<!DOCTYPE html><html> <head> <meta charset="UTF-8" /> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $.ajax({ url: "converted39.json", dataType: 'json', success: function(tree) { traverse($('#treeView'), tree) $('#treeView li:has(li)').addClass("Max").click(function(e) { $(this).toggleClass("Max Min"); $(this).children("ul").toggle(); e.stopPropagation(); }) $("[href]").addClass("Blue").click(function(e){ $(this).toggleClass("Purple"); e.stopPropagation(); window.location.href = $(this).attr("href") }) $('#treeView li').click(function(g) { var mytree2 = $(this); mytree2.children('li').toggle(); g.stopPropagation(); }) } }) }); function traverse(node, o) { for (var i in o) { if(i == "__text" || i == "_href" ) continue; if (o !== null && typeof(o)=="object") { if(o.__text){ var ul = $("<ul>").appendTo(node) var node=$('<li>').appendTo(ul) if(o._href){ var n = $("<span>").appendTo(node) $(n).text(o.__text).attr("href", o._href) } else{ $(node).text(o.__text) } } } traverse(node,o); } else{ var ul = $("<ul>").appendTo(node) if(o.__text){ var li = $('<li>' + o._text + '</li>').appendTo(ul) if(o._href){ var n = $("<span>").appendTo(node) $(n).text(o.__text).attr("href", o._href) } }else{ $('<li>' + o + '</li>').appendTo(ul) } } } } </script> JSON CODE:{ "MAIN": { "MainStation": [ { "Substation": [ { "Control": "Control1n", "ControlExpandable": { "MiniControl": [ "MiniControl1", "MiniControl2" ], "__text": "Control2" }, "PushButton": { "__text": "PushButton1", "_attr": "successnDatffffffffffffffffffffffffffffffffffffffffffffffffffffffffe:17july" }, "_href": "http://google.com", "__text": " Substation1nnnnnnn" }, { "ControlExpandable": { "MiniControl": [ "MiniControl1", "MiniControl2" ], "__text": "Control1", "_attr": "Control1 woohoo" }, "Control": "Control2", "PushButton": "PushButton1", "__text": " Substation2nnnnnnn" }, { "Control": [ "Control1", "Control2", "Control3", "Control4" ], "__text": " Substation3nnnnnnnnn" }, { "PushButton": [ "PushButton1", "PushButton2" ], "__text": " Substation4nnnnn" } ], "__text": " Mainstation1nnnnnnnnn" }, { "Substation": [ { "Control": [ "Control1", "Control2" ], "PushButton": "PushButton1", "__text": " Substation1nnnnnnn" }, { "ControlExpandable": { "MiniControl": [ "MiniControl1", "MiniControl2" ], "__text": "Control1" }, "Control": "Control2", "PushButtonExpandable": { "MiniPushButton": [ "MiniPushButton1", "MiniPushButton2" ], "__text": "PushButton1" }, "__text": " Substation2nnnnnnn" } ], "__text": " Mainstation2nnnnn" } ], "ElectricStation": { "Substation": [ { "Control": [ "Control1", "Control2" ], "PushButton": "PushButton1", "__text": " Substation1nnnnnnn" }, { "ControlExpandable": { "MiniControl": [ "MiniControl1", "MiniControl2" ], "__text": "Control1" }, "Control": "Control2", "PushButtonExpandable": { "MiniPushButton": [ "MiniPushButton1", "MiniPushButton2" ], "__text": "PushButton1" }, "__text": " Substation2nnnnnnn" } ], "__text": " ElectricStation1nnnnn" }, "__text": " MAINnnnnnnn" }}
  7. Bootstrap sounds a bit like a finished optional program to use? also It seemed like when I first started seeing this page I have been learning from, that it is trying to "sell me" on the HTML5 as a good new and easier way to think of html code I wonder if this stuff has any merit? is it true? Is there any particular Web and computer code language *(scripting etc,) that are universal, or more functional for a different similar type? like for example I have read that someone wrote "there personal favorite scripting is" and similar quoted. Is there any that are not liked or favored by many, but are more sort of fundamentally necessary to and work very well, and will be around to stay? It seems like to me HTML, is the way things are done, also interactions with internet and computers happens with javascript. As I have researched more about how it all works, It seems there are database languages that are used as well, and of course web page layout - CSS, it seems like some of these must be more of a basic foundation? I would like to focus on the types of web coding that have stood the test of time? types of code that aren't going anywhere due to the nature of how they function is not likely to be outdated soon? some of the questions and comments are referring to, jSON, mySql, appML, PHP, jquery, CSS, bootsrap, html5, (html5 vs. HTML or XHTML), xml, are any of the things listed Proprietarily limited more-so than others? or do any of them duplicate function of another? all generally speaking, I am sure there are reasons for everything. but to cut down the cluster of things to learn? which is important, and if multitudes of things are important enough to learn. which order is best?
  8. Hello everyone!I need your help.I have this code: @BuildTreeView(treeView, IdCategoriaParente) @helper BuildTreeView(IEnumerable<dynamic> data, int catfiglia, int? idcategoriaparente = 1, int level = 0, string accumulatore = ""){ // // var selectRecord = ""; var nodes = data.Where(n => n.IdCategoriaParente == idcategoriaparente).OrderBy(n => n.Id); var separatore = ""; if (nodes.Any()) { if (nodes.First().IdCategoriaParente != null) { if (level > 0) { separatore = " >> "; } } if (level == 0) { /* @Html.DropDownList("Direction", new List<SelectListItem>{ new SelectListItem{ Text = "Home To School", Value = "0" }, new SelectListItem{ Text = "School To Home", Value = "1" }}, new { onchange = "getAlldata()" }) */ @Html.Raw("<select name="IdCategoriaParente" id="IdCategoriaParente">"); @Html.Raw("<option value="0">Nessuna</option>"); } foreach (var node in nodes) { if (node.Id == catfiglia) { selectRecord = "selected"; } //Funzioni.SelezionaSelect(node.Id, catfiglia) else { selectRecord = ""; } var fullText = accumulatore + separatore + node.NomeCategoria; @Html.Raw(string.Format("rn<option value="{0}" {2}>{1}</option>", node.Id, fullText, selectRecord)); @BuildTreeView(data, catfiglia, node.Id, level + 1, fullText); } if (level == 0) { @Html.Raw("rn</select>"); } } else { // @Html.Raw("<select name="IdCategoriaParente" id="IdCategoriaParente"><option value="0">Nessuna</option></select>"); }} It is working properly. The problem is that now, the result is printed on the screen with a select.I wish the result was made into a JSON format: {"...", "...", "...": ...}Can you help me?Thanks in advance
  9. Good day everyone, Do you have a Google Translate script, as much as possible a URL, that returns a JSON format? For example I pass this URL using an AJAX request: https://google-translate-api-domain.com/q=large〈=english&to=afrikaans maybe it will return: {"translation":"groot"} Thanks in advance! - Regicide Del Feroz
  10. I desperately need to get some simple data from a file into a table on a web page. I've been pointed to using JSON, but I'm not getting something(s) correct with implementation. I'm not sure what I'm doing wrong and I've spent hours on the task. I'm not a developer, but I can follow instructions. Any help will be greatly appreciated. Here is what I have set up: A simple web page. The code is pasted below. A simple JSON file (new.json). It is in the same path as the web page (C:xampphtdocsxamppaudit). The file's contents are pasted below. I'm running XAMPP as my server. Only Apache is turned on. I've placed a copy of jquery-1.11.2.min.js on my web server. I've tried placing the copy at both C:xampphtdocsxampp and C:xampphtdocsxamppaudit, but I have no idea if this is correct or not. I'll be very grateful for any assistance in getting the web page to return the contents of the new.json file into a table on the web page. Thanks in advance, Andrew PS. I do have a separate and related thread going here, but I started too advanced. Right now, I just need something simple. I'll work with the details in the other thread after I get a working import. web page code <!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 content="text/html; charset=utf-8" http-equiv="Content-Type" /><title>JSON 3</title><style>table { border: 1px solid #666; width: 100%;}th { background: #f8f8f8; font-weight: bold; padding: 2px;}</style></head><body>Example from: <a href="http://jsfiddle.net/sEwM6/258/">http://jsfiddle.net/sEwM6/258/</a><br/><br/><table id="personDataTable"> <tr> <th>Id</th> <th>First Name</th> <th>Last Name</th> </tr></table><script>$.ajax({ url: 'new.json', //Change this path to your JSON file. type: "post", dataType: "json", success: function(data, textStatus, jqXHR) { drawTable(data); }});function drawTable(data) { var rows = []; for (var i = 0; i < data.length; i++) { rows.push(drawRow(data[i])); } $("#personDataTable").append(rows);}function drawRow(rowData) { var row = $("<tr />") row.append($("<td>" + rowData.id + "</td>")); row.append($("<td>" + rowData.firstName + "</td>")); row.append($("<td>" + rowData.lastName + "</td>")); return row;}</script></body></html> new.json data: {json: JSON.stringify([{id: 1,firstName: "Peter",lastName: "Jhons"},{id: 2,firstName: "David",lastName: "Bowie"}]}
  11. Ok, Hi everyone. I found this awesome and simplistic shopping cart on codepen.com BUT I do not know how to make it work .... :(TO begin with here is the link for it: http://codepen.io/bartveneman/details/KHxLGI am using Dreamweaver to make my website. So I copied it all, made sure that the links between my html, css and js are working fine and it still does not work. My problem with it is as follows: I did a copy+paste on it cannot shows me the cart without any items. I do not know how to add items without ruining the JS which will calculate things like total price, subtotal, etc. Things that I tried [ if you know exactly what I need to do don't bother reading what I tried, I am a beginner anyways ] I tried replacing inside the HTML the places where it says things like "src="{{=img}}" I would replace it the source with an actual source path for an image which works but shows nothing at all. I tried then also here in the HTMl file to simply take the tag off. As you see the html is based on one top part which is a big tag then is has the footer. The items are inside the tag at the top, BUT the tag is enclosed within some script tag so I removed the script and it shows one item ok-ish. The problem with this is that it would function with the script. For example it shows the item now but I cant add it to cart anything. Lastly, I looked inside the JS file and I found the section with the app variable which seems to have the details for the items included in the example. I changed those but nothing shows... So I tried some basic stuff. If anybody can help me with this by the end of the weekend it would be great !
  12. <?php$salename=json_encode($oSales);?> I need pass variable in php script to javaScript code in series <script type="text/javascript"> $(function () {$('#lineChartSales').highcharts({chart: {type: 'line'},title: {text: 'Monthly Average Sales'},xAxis: {categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']},yAxis: {title: {text: 'Temperature (°C)'}},plotOptions: {line: {dataLabels: {enabled: true},enableMouseTracking: true}},series: [{name:a,data: [1, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]},{name: b,data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]}]});});</script> Any help Thanks
  13. Hello, I have a php web page that contains graphics, and I want to incorporate into this web page a drop-down list, selecting the year, we display the graphic that matches this year at the same page ... I created the drop-down list in html but I know how to have when you click on an item in the drop-down list displays all my graphics in the same web page. here is the list that I created: <form name="test" method="post" action ="home.php"><select name="annee" onChange="this.form.submit()"> <option value="1"> 2009</option> <option value="2" >2010</option> <option value="3">2011</option> <option value="4">2012</option></select> Here is my graphics : <div class="col-lg-6"><div class="panel-body text-center"> <script type="text/javascript"> $(document).ready(function() { var options = { chart: { renderTo: 'container0', type: 'column', }, title: { text: 'Evolution trimestrielle du Parc Mobile ' }, xAxis: { categories: ['mars-08','juin-08','sept-08','déc-08','mars-09' ] }, yAxis: { min: 0, title: { text: 'millions' }, }, legend: { enabled: false }, plotOptions: { series: { dataLabels: { enabled: true, format: '{point.y:.1f}' }}}, tooltip: { pointFormat: ' <b>{point.y:.1f} millions</b>' }, series: [] } $.getJSON("evte.php", function(json){ //options.xAxis.categories=json[0]['data']; options.series[0]=json[0];chart=new Highcharts.Chart(options);}); });</script> <div id="container0" style="min-width: 400px; height: 400px; margin: 0 auto"> </div> </div></div> <div class="col-lg-6"><div class="panel-body text-center"> <script type="text/javascript">$(document).ready(function() { var options = { chart: { renderTo: 'container', type: 'column', }, title: { text: 'Répartition Prépayé Post-payé' }, xAxis: { categories: ['mars-08','juin-08','sept-08','déc-08','mars-09'] }, yAxis: { min: 0, title: { text: 'milliers' }, stackLabels: { enabled: true, style: { fontWeight: 'bold', color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray' } } }, legend: { align: 'center', x: 10, verticalAlign: 'under', y: 371, floating: true, backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white', borderColor: '#CCC', borderWidth: 1, shadow: false }, tooltip: { formatter: function () { return '<b>' + this.x + '</b><br/>' + this.series.name + ': ' + this.y + '<br/>' + 'Total: ' + this.point.stackTotal; } }, plotOptions: { column: { stacking: 'normal', dataLabels: { enabled: true, color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white', style: { textShadow: '0 0 3px black, 0 0 3px black' } } } }, series: [] } $.getJSON("repartition.php", function(json){ options.series[0]=json[0]; options.series[1]=json[1]; chart=new Highcharts.Chart(options);}); }); </script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"> </div> </div> </div> </div></div></div> <div class="tab-pane fade" id="service-two"> <br/> <div class="col-lg-6"><div class="panel-body text-center"> <script type="text/javascript"> $(document).ready(function() { var options = { chart: { renderTo: 'container09', type: 'column', }, title: { text: 'Evolution trimestrielle du Parc Mobile (en milliers)' }, xAxis: { categories: ['juin-08','sept-08', 'déc-08','mars-09','juin-09' ] }, yAxis: { min: 0, title: { text: 'millions' } }, legend: { enabled: false }, plotOptions: { series: { dataLabels: { enabled: true, format: '{point.y:.1f}' }}}, tooltip: { pointFormat: ' <b>{point.y:.1f} millions</b>' }, series: [] } $.getJSON("evtrimmobile juin09.php", function(json){ options.series[0]=json[0];chart=new Highcharts.Chart(options);}); }); </script> <div id="container09" style="min-width: 400px; height: 400px; margin: 0 auto"> </div> </div></div> <div class="col-lg-6"><div class="panel-body text-center"> <script type="text/javascript"> $(document).ready(function() { var options = { chart: { renderTo: 'containerr09', type: 'column', }, title: { text: 'Répartition Prépayé Post-payé' }, xAxis: { categories: ['juin-08','sept-08','déc-08','mars-09','juin-09'] }, yAxis: { min: 0, title: { text: 'milliers' }, stackLabels: { enabled: true, style: { fontWeight: 'bold', color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray' } } }, legend: { align: 'center', x: 10, verticalAlign: 'under', y: 371, floating: true, backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white', borderColor: '#CCC', borderWidth: 1, shadow: false }, plotOptions: { series: { dataLabels: { enabled: true, format: '{point.y:.1f}' }}}, tooltip: { formatter: function () { return '<b>' + this.x + '</b><br/>' + this.series.name + ': ' + this.y + '<br/>' + 'Total: ' + this.point.stackTotal; } }, plotOptions: { column: { stacking: 'normal', dataLabels: { enabled: true, color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white', style: { textShadow: '0 0 3px black, 0 0 3px black' } } } }, series: [] } $.getJSON("repartitionm.php", function(json){ options.series[0]=json[0]; options.series[1]=json[1]; chart=new Highcharts.Chart(options);}); }); </script> <div id="containerr09" style="min-width: 400px; height: 400px; margin: 0 auto"> </div> </div></div> </div> PS: graphics are created using software Highcharts Thank you for helping me.
  14. Hi, I have this following code: http://jsfiddle.net/dustcomposer/bapwnhy0/ var cresc_path = '<path class="dyna_line" id="dyna_line" d="M ' + 0 + ' ' + 0 + ' L ' + 50 + ' ' + 25 + ' M ' + 0 + ' ' + 50 + ' L ' + 50 + ' ' + 25 + '" style="stroke-width: 1; stroke: red; fill:none;" />';var dl = document.createElementNS("http://www.w3.org/2000/svg", "svg");dl.setAttribute('class', 'dyHolder');dl.setAttribute('id', 'dyHolder');dl.setAttribute('style', 'border:1px solid red');dl.setAttribute('width', '50');dl.setAttribute('height', '50');dl.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink");dl.innerHTML = cresc_path;document.getElementById('a').appendChild(dl);var str = '<svg class="dyHolder" id="dyHolder" style="border:1px solid red" width="50" height="50" xmlns:xlink="http://www.w3.org/1999/xlink"><path class="dyna_line" id="dyna_line" d="M 0 0 L 50 25 M 0 50 L 50 25" style="stroke-width: 1; stroke: red; fill:none;"></path></svg>';document.getElementById('b').innerHTML = str; both dl and str does result a svg image in html page. but when I grab similar string with str from json file, it appears as text like: <svg class="dyHolder" id="dyHolder" style="border:1px solid red" width="50" height="50" xmlns:xlink="http://www.w3.org/1999/xlink"><path class="dyna_line" id="dyna_line" d="M 0 0 L 50 25 M 0 50 L 50 25" style="stroke-width: 1; stroke: black; fill:none;"></path></svg> can anyone explain what the problem is? UPDATE: I've found the problem! the saved json structure must be typed neat. If the json structure made like this: [[ "28/11/2014 - 7:7", "", "", ""],[ "", "", "", ""],["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "<svg class="dyHolder" id="dyHolder" style="border:none" width="140" height="10" xmlns:xlink="http://www.w3.org/1999/xlink"><path class="dyna_line" id="dyna_line" d="M 0 0 L 140 5 M 0 10 L 140 5" stroke-width="1" stroke="black" fill="none"></path></svg>"]] the svg (as string) won't appears as svg but a paragraph/text. therefore it should written like this: [[ "28/11/2014 - 7:7", "", "", ""],[ "", "", "", ""],[ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],[ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],[ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],[ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "<svg class="dyHolder" id="dyHolder" style="border:none" width="140" height="10" xmlns:xlink="http://www.w3.org/1999/xlink"><path class="dyna_line" id="dyna_line" d="M 0 0 L 140 5 M 0 10 L 140 5" stroke-width="1" stroke="black" fill="none"></path></svg>"]] Everything works well now.
  15. Hi to all, i hope to find some help here. This is my problem, which need urgent help. Im working on a chrome extension, VERY VERY basic. My extension block a list of "urls" so i have 2 files for my chrome extension, my manifest.json and background.js Code of manifest.json: {"name":"Stop-it","description":"app","version":"1.0,"manifest_version":2,"permissions": ["webRequest","webRequestBlocking","unlimitedStorage"],"icons":{"48":"icon.png"},"background":{"scripts": ["background.js"]},"browser_action":{"default_popup":"popup.html","default_icon":"icon.png"}} and the code of my background.js: chrome.webRequest.onBeforeRequest.addListener( function(details) {return {cancel: true};}, { urls:[ .url1, .url2, etc... ] },['blocking']); at the moment i store all the urls, inside the background.js, and thats the problem, because its a list of urls i update every week, and my urls list has 2 millions urls, so when i install my extension, and start browsing, chrome become really really slower. I really need help on this problem, the manifest.json, is perfect and work perfectly, the problem come from my background.js, how to store all those urls on the user computer, instead of the background.js, i add here a jpeg file who show the memory consumption in chrome. thanks to all
  16. I have been trying to develop my google places map. I found this page, https://developers.g...on/autocomplete which is what I think I want. I want to be able to search a specific word and return only results that I input. I am not sure how to link the JSON script to the XML. I need some help.
  17. 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.
  18. 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..
  19. 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..
  20. 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..
  21. 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
  22. <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?
  23. 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.
  24. 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>
  25. 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!