javascript - no element error on ajaxing to php file -


i'm trying connect javascript , php files , no element error , couldn't figure out. in advance! +anyone can recommend ways debug these..?

<html> <head> <title>ajax!!!!</title> <meta charset="utf-8"/> <link href="main.css" rel="stylesheet" type="text/css"/>  </head>  <body>  <h1>home</h1>  <h4>enter id</h4>  <p>summoners name: <input type="text" id="summonername"></p> <button id="sumname">search!</button>  <button id="renewdata"> renew data</button>  <button id="testing"> renew data</button>  <div id="result">display result</div>  <script src="jquery/jquery.js"></script>   <script type = "text/javascript">  $(document).ready(function(){  $('#testing').on('click', function(){      $.ajax({       type : 'get',       url: 'test.php',       data : {str: $("#summonername").val()},       success: function (msg) {          $('#result').html("hh");       },       error: function (xmlhttprequest, textstatus, errorthrown) {             alert(errorthrown);         }       });  }); 

});

});

and php file

<?php      if ($_get['str']) :          echo "yes";     endif; ?> 

had delete functions in javascript part

i run code jsfiddle working fine. may helps you.

html

<div id="result"></div>  <button id="testing">get external content</button> 

js

 $(document).ready(function(){     //testing button      $('#testing').on('click', function(){              $.ajax({               type : 'get',               url:'https://raw.githubusercontent.com/sumanbogati/test/master/test.php',               data : {str: $("#sum").val()},               success: function (msg) {                  $('#result').html("hh");               },               error: function (xmlhttprequest, textstatus, errorthrown) {                     alert("error getsasadds!"); //this statement given out                 }               });      }); }); 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -