search

Home  >  Q&A  >  body text

The navigation bar I downloaded directly from bootstrap also introduced jquery.js. Why can't I click on the drop-down menu?

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{$title|default="页面标题"}</title>
<link rel="stylesheet" href="/static/css/bootstrap.css">
<script type="/static/js/jquery-3.6.0.min.js"></script>
<script type="/static/js/bootstrap.min.js"></script>
</head>
<body>

The navigation bar I downloaded directly from bootstrap also introduced jquery.js. Why can’t I click on the drop-down menu?

And my ajax used for registration verification also passed. Where did I go wrong?

走过沙漠的骆驼走过沙漠的骆驼1241 days ago810

reply all(3)I'll reply

  • 猪老湿

    猪老湿2021-09-21 09:38:55

    What is the console error message? Are all external scripts imported correctly?

    reply
    0
  • 走过沙漠的骆驼

    Teacher, there is no response or prompt when I click the pull-down button.

    走过沙漠的骆驼 · 2021-09-21 15:41:14
    走过沙漠的骆驼

    Teacher, the drop-down problem is caused by the introduction of js and has been solved. $(function(){ $("#register").on('click',function(){ alert($('#login').serialize()); }) }) $(function(){ $("#register").on('click',function(){ $.ajax({ type:'post', url:"{:url('index/user/insert')}", data:$('#login').serialize(), dataType:'json', success:function(data){ alert('successful'); } }) }) }) But when I insert the registration data, the first script can pop up a prompt box with submitted data, but the following script cannot succeed and there is no prompt message? Ask the teacher to help. Below are the insert questions, I followed them as written. public function insert() { if(Request::isAjax()){ //Use model to create data //Get the data submitted by the user through the form //data is a variable used to obtain data, it is an array $data = Request::except('password_confirm','post'); if(UserModel::create($data)){ return['status'=>1,'message'=>'Congratulations, registration is successful']; }else{ return['status'=>0,'message'=>'Registration failed, please check']; } }else{ $this->error("Request type error",'register'); } }

    走过沙漠的骆驼 · 2021-09-22 16:16:02
  • Cancelreply