fork download
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>JSONTest</title>
  5. <script src="js/jquery-1.9.1.min.js"></script>
  6. <script type=text/javascript>
  7. $(document).ready( function() {
  8. $("input:button").click(function(){
  9. $.ajax({
  10. type: "GET",
  11. url: "test2.php",
  12. //JSON typeでは読み込めなかったためtxtとして読み込む
  13. //dataType:"json",
  14. success: function(msg) {
  15. console.log(msg);
  16. //ここでtxtをJSONに変換しようとしてエラー ・
  17. console.log(eval(msg));
  18. },
  19. false: (function(jqXHR, textStatus, errorThrown) {
  20. console.log("Error: " + textStatus);
  21. console.log("Test: " + jqXHR.responseText);
  22. })
  23. });
  24. });
  25. });
  26.  
  27. </script>
  28. </head>
  29.  
  30. <body>>
  31. <input type="button" value="testButton" />
  32. </body>
  33. </html>
Runtime error #stdin #stdout 0.38s 381888KB
stdin
Standard input is empty
stdout
Standard output is empty