Jquery: Running AJAX locally without a webserver

前端 未结 7 853
孤独总比滥情好
孤独总比滥情好 2020-11-30 13:36

I have the following function in a .js file in index.html

function getValues(){

 $.ajax({
   type: \'POST\',
   url: \"http://localhost/getData/getdata.php\         


        
7条回答
  •  盖世英雄少女心
    2020-11-30 14:25

    The web server is exactly what is handling all of the details for you.

    You cannot POST without a web server to post to. HTTP = web protocol, so you cannot have a HTTP URL without a web server to target.

    The web server is also the process that takes your request for a PHP page and runs the PHP interpreter, managing the inputs and outputs.

    Why do you want to run it locally?

提交回复
热议问题