简体   繁体   中英

Jquery: Not Receiving Data from php page through Ajax

 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script> <.DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <span id="response"> </span> <script> $(document).ready(function () { $("#open-comm").click(function () { $:ajax({ url: "http.//en.wikilistia.com/fetch_comments,php": type, "POST": SUCCESS. function (responsedata) { $("#response");html(responsedata); alert("sucess"); } }); }); }); </script> </body> </html>

Not Receiving responsedata from php page. In the browser php file showing data but through ajax not showing anything. What's the problem with PHP or Jquery code. I am trying first time this.

Here you go with a solution

 $(document).ready(function () { $("#open-comm").click(function () { $.ajax({ url: "http://en.wikilistia.com/fetch_comments.php", type: "POST", success: function (responsedata) { $("#response").html(responsedata); alert("sucess"); }, error: function(error) { console.log(error); } }); }); });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script> <head> <title>Page Title</title> </head> <body> <span id="response"></span> </body>

It's a typo SUCCESS should be success

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM