How to run this AJAX JavaScript Coding?
A PHP Error was encountered
Severity: Notice
Message: Undefined index: userid
Filename: views/question.php
Line Number: 191
Backtrace:
File: /var/www/html/cnasolution/application/views/question.php
Line: 191
Function: _error_handler
File: /var/www/html/cnasolution/application/controllers/Questions.php
Line: 419
Function: view
File: /var/www/html/cnasolution/index.php
Line: 315
Function: require_once
How to run this AJAX JavaScript Coding?
My Source from W3 Schools : https://www.w3schools.com/js/tryit.asp?filename=tryjson_ajax_array
When I running this ajax example in w3 source it's running successfully.
When I try to execute the same code in my local its' not running .The code is below.
Is there I need any server for running this example.
ajax.html
Use the XMLHttpRequest to get the content of a file.
json_demo.txt
{ "name":"John", "age":31, "pets":[ { "animal":"dog", "name":"Fido" }, { "animal":"cat", "name":"Felix" }, { "animal":"hamster", "name":"Lightning" } ] }
How to run this file in my local computer? Help me to begin my Ajax Learning......