Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在发送请求时,jquery没有定义ajax_Javascript_Jquery_Ajax - Fatal编程技术网

Javascript 在发送请求时,jquery没有定义ajax

Javascript 在发送请求时,jquery没有定义ajax,javascript,jquery,ajax,Javascript,Jquery,Ajax,我得到了这个例外 $.ajax不是一个函数 在下面的代码中!我做了足够的研究,但没有找到合适的解决方案。我还没有使用过超薄版的CDN。我在这个HTML文件中使用的是引导,它和什么有关系吗 <!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewpo

我得到了这个例外

$.ajax不是一个函数

在下面的代码中!我做了足够的研究,但没有找到合适的解决方案。我还没有使用过超薄版的CDN。我在这个HTML文件中使用的是引导,它和什么有关系吗

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Bootstrap CSS -->
    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
     <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">

    <title>Great India</title>
  </head>
  <body>
    <div class="row">
      <div class="col-sm-4">
      </div>
      <div class="col-sm-4">
        <h1>Sign Up</h1>
      </div>
      <div class="col-sm-4">
      </div>
    </div>

    <div class="row">
      <div class="col-sm-4">
      </div>
      <div class="col-sm-4">
        <form>
          <div class="form-group">
            <label for="exampleInputEmail1">Email address</label>
            <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
            <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
          </div>
          <div class="form-group">
            <label for="exampleInputPassword1">Password</label>
            <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
          </div>
          <div class="form-group form-check">
            <input type="checkbox" class="form-check-input" id="exampleCheck1">
            <label class="form-check-label" for="exampleCheck1">Check me out</label>
          </div>
        </form>
        <button id="signup" class="btn btn-primary">Submit</button>
      </div>
      <div class="col-sm-4">
      </div>
    </div>
    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->


    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
    <script src="rest.js"></script>
    <script>
    $("#signup").click(function()
    {
      var json='{"id":"SomeId","title":"SomeTitle"}';
      var obj=JSON.parse(json);

          $.ajax({
            url:"http://127.0.0.1:8080/signup",
            type: "POST",
            dataType: "json",
            data: obj,
            contentType: "application/json",
            cache: false,
            timeout: 5000,
            complete: function() {
              //called when complete
              console.log('process complete');
            },

            success: function(data) {
              console.log(data);
              console.log('process sucess');
           },

            error: function() {
              console.log('process error');
            },
          });
    });
    </script>
  </body>
</html>

大印度
注册
电子邮件地址
我们永远不会与其他人共享您的电子邮件。
密码
看看我
提交
$(“#注册”)。单击(函数()
{
var json='{“id”:“SomeId”,“title”:“SomeTitle”}';
var obj=JSON.parse(JSON);
$.ajax({
url:“http://127.0.0.1:8080/signup",
类型:“POST”,
数据类型:“json”,
资料来源:obj,
contentType:“应用程序/json”,
cache:false,
超时:5000,
完成:函数(){
//完成时调用
console.log(“进程完成”);
},
成功:功能(数据){
控制台日志(数据);
console.log('processsuccess');
},
错误:函数(){
console.log('processerror');
},
});
});
我正在尝试向节点js服务器发送请求

我没有使用过超薄版的CDN

您有两个相同的
script
链接指向JQuery min(一个接一个)和一个指向JQuery slim

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>

JQuery slim脚本引用位于JQuery min链接之后,因此它覆盖了
$
引用,JQuery slim排除了AJAX功能


仅供参考:您还有两个指向引导的相同链接。

为什么您有两个指向JQuery和引导的链接?我没有使用过slim版本的CDN!我知道你是!就在那里,就在HTMLTANK的尽头,谢谢!刚刚找到它!9分钟后,我将选择正确的答案!