jq ajax 发送数据
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<title>Document</title>
</head>
<body>
<input type="text" name="title" id="fileName">
<button id="btn">发送</button>
<script>
$(function(){
$("#btn").click(function(){
var fileName = $("#fileName").val();
$.get("./fileName",{'fileName':fileName},function(data,status){
});
})
})
</script>
</body>
</html>
nodejs得到数据
//nodejs与jq的结合
var express = require("express");
var app=express();
app.set("view engine","ejs");
app.get("/fileName",function(req,res){
res.render("jqSendData");
console.log(req.query);
})
app.listen(3000);
``
网友评论