jQuery Ajax

Next ❯JSON Eval

  • jquery makes ajax more easy to use
  • turned_in_notJSON via jQuery Ajax

    In jquery $.getJSON() method, already converts JSON String into object. So, only for this jquery ajax method you don't have to useJSON.parse()

    Below example, both your html and json files are in the same folder

    <!DOCTYPE html>
    <html>
    <head><title>JSON Example via jQuery</title>
    <!--Required jQuery Library file-->
    <script src="jquery.min.js"></script>
    </head>
    <body>
    <p>Hi, My name is <span id="show"></span></p>
    <script>
     $.getJSON("jsoncode.json",function(result){
     //Now you can show your result object as per your need
        $("#show").html(result.name);
      });
    </script>
    </body>
    </html>
    "jsoncode.json" file
    { "name":"Riya","age":23 }
    OUTPUT

    Hi, My name is


  • JSON Eval
Next ❯JSON Eval
TryOut Examples"Learn to Explore..!"

TryOut Editor

receipt