weixin_33688840 2015-03-27 15:38 采纳率: 0%
浏览 21


So I have this little script that fetches word definition from database. It's working fine. But as soon as I try to replace the default html input and button with Bootstrap stuffs by including Bootstrap CDN link in the header, it no longer works. There is no error, but the script simply won't fetch the result.

I have tried with different CDN link and everything I could with my limited jQuery knowledge. But I stuck. Below is my script. I have not included PHP script that responses JSON to jQuery AJAX script because it works fine too.

How can I fix my script so that I get it working? Right now, even simply inserting CDN link in the header make the script stop working.

  $('#word-submit').on('click', function(){
    var word = $('#word').val();
    if ($.trim(word) != ''){
      $.post('ajax/name.php', {word: word}, function(data){
        var obj = jQuery.parseJSON(data);
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="style.css">

    <div id="container">
      <form autocomplete="off" class="form-inline">
        <input type="text" id="word" >
        <input type="button" id="word-submit" value="Tam" class="sr-only" >

      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
      <script src="js/global.js" charset="UTF-8"></script>


  • 写回答



      相关推荐 更多相似问题


      • ¥15 macOS使用IDEA 2022.2.4打包JDK6项目报错
      • ¥20 OpenCV-Python简单轮廓寻找
      • ¥20 使用matlab进行含参数的最优化求解及数值模拟
      • ¥20 MATLAB找出一维变量中的局部极大值和局部极小值,并进行运算
      • ¥15 有Chang求三维杆单元几何非线性分析matlab代码
      • ¥50 使用unity easyar录屏功能。录屏视频整体色调很暗
      • ¥50 pyinstaller 打包问题
      • ¥15 无法使用cnssc调取网页数据
      • ¥15 Pycharm安装en_core_web_sm失败出现Could not find a version that satisfies the requirement spacy报错
      • ¥15 Python社区划分