当前位置: 首页 > 编程日记 > 正文

JQ+ajax 提交表单不跳转页面

微信小程序开发交流qq群   173683895

   承接微信小程序开发。扫码加微信。

代码

		<div class="apply_box"><h1>合作申请</h1><div class="apply_l"><input type="text" maxlength="20" id="name" name="name" placeholder="您的姓名"><input type="number" maxlength="14" id="phone" name="phone" placeholder="您的电话"><input type="text" id="company" name="company" placeholder="您的公司"></div><div class="apply_r"><textarea name="detail" id="detail" cols="30" rows="10" placeholder="需要咨询的合作"></textarea><input type="submit" id="sub" value="提交申请"></div><script type="text/javascript">$('#sub').click(function() {var aa = $("#detail").val();console.log(aa)$.post("https:/xxx.cn/api/xxx.do", {name: $("#name").val(),phone: $("#phone").val(),company: $("#company").val(),page: 'index',detail: aa,},function(data) {alert("Data: " + data);});});</script></div>

注意:JQ获取textarea的值的时候,在post里面无法通过$("#detail").val()获取到值,需要在事件创建一个变量获取它;

实现:post提交表单通过JQ的AJAX提交,达到不刷新,不跳转页面的效果

不能加form 。

相关文章:

node.js是开源的吗_为开源做贡献并不难:我为Node.js项目做贡献的旅程

node.js是开源的吗As a developer, you should consider contributing to open source software. Many of your potential employers will look favorably on these contributions.作为开发人员&#xff0c;您应该考虑为开源软件做贡献。 您的许多潜在雇主将对这些供款看好。 …

超级简单的jquery轮播图demo

<!DOCTYPE html> <html><head><meta charset"UTF-8"><title>轮播图demo</title><script type"text/javascript" src"js/jquery-3.2.1.slim.js" ></script><link rel"stylesheet" …

Mysql 操作技巧

复制表结构 表数据Mysql> create tables t2 like t1;Mysql> insert into t2 select * from t1; mysql 索引a、Alert Table 用来创建普通索引、Unique 唯一索引 (当前列数值不可重复) 或 Primary Key 主键索引Mysql> alter table table_name add index index_name(col…

JS实现复制到剪切板效果

微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 代码&#xff1a; <!DOCTYPE html> <html lang"en"><head><meta http-equiv"Content-Type" content"text/html; charsetutf-8" /><meta cha…

如何管理多个Python版本和虚拟环境

Addition January 2019: If you are coming back to this blog after upgrading to macOS Mojave please see this github issue for a solution to the common pyenv ‘zlib not available’ problem.此外&#xff0c;2019年1月&#xff1a;如果在升级到macOS Mojave之后又回到…

linux 下byte,char,unsigned char的区别

在linux中&#xff0c;对byte的定义为无符号char&#xff0c;而char默认为有符号char。 #ifndef BYTE #define BYTE unsigned char #endif以下ZZ百度知道&#xff1a; 在C中&#xff0c;默认的基础数据类型均为signed&#xff0c;现在我们以char为例&#xff0c;说明(signed) c…

词法作用域和动态作用域

JavaScript采用的是词法作用域 1.词法作用域 即函数定义时&#xff0c;即确定的作用域。js中的作用域链&#xff0c;在函数声明时候&#xff0c;就已经确定了&#xff0c;无论函数在何处调用&#xff0c;其作用域变量的查找都是按照定义是包含关系去查找。 2.动态作用域 变量的…

10-18 JS基础复习笔记

微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 1.JS类型 Numbel String Boolean Symbol Null Undefined Object(Funtion,Array,Data,Regexp); 2.字符串转数字类型 "122" //122 var a 1 2; console.log(a) //3 3.null 和 u…

vue.js crud_如何使用VS Code和ADO.NET使用ASP.NET Core执行CRUD操作

vue.js crud介绍 (Introduction) In this article we are going to create a web application using ASP.NET Core MVC with the help of Visual Studio Code and ADO.NET. We will be creating a sample Employee Record Management System and performing CRUD operations on…

redis事物命令示例

命令示例&#xff1a; 1. 事务被正常执行&#xff1a;#在Shell命令行下执行Redis的客户端工具。/> redis-cli#在当前连接上启动一个新的事务。redis 127.0.0.1:6379>multiOK#执行事务中的第一条命令&#xff0c;从该命令的返回结果可以看出&#xff0c;该命令并没有立即执…

JS 函数 函数递归

微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 重要&#xff1a;函数也是对象&#xff0c;你可以给它们添加属性或者更改它们的属性。 函数内部对象&#xff1a;arguments 解析&#xff1a;函数实际上是访问了函数体中一个名为 arguments 的内部对象…

swift设置启动图不现实_如何通过装饰房屋来开始在Swift中使用增强现实

swift设置启动图不现实by Ranadhir Dey由Ranadhir Dey 如何通过装饰房屋来开始在Swift中使用增强现实 (How to get started with augmented reality in Swift by decorating your home) If you’ve read my previous post, you already have a beautiful AR floor in your din…

可用于nodejs的SuperAgent(ajax API)

简单示例&#xff1a; import request from superagent;//引用声明 request.post(api).withCredentials()//跨域.end((err, res) > {if (res.ok) {const json JSON.parse(res.text);} else {console.log(获取失败);}}); 1、get 方式 当使用get请求传递查询字符串的时候&…

Java第四次实验

一、实验内容&#xff1a; 结对编程。运行TCP代码&#xff0c;结对进行&#xff0c;一人服务器&#xff0c;一人客户端&#xff1b;利用加解密代码包&#xff0c;编译运行代码&#xff0c;一人加密&#xff0c;一人解密&#xff1b; 集成代码&#xff0c;密后通过TCP发送。 二、…

JS 面向对象编程之原型(prototype)

微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 function Person(first, last) {this.first first;this.last last; } Person.prototype.fullName function() {return this.first this.last; } Person.prototype.fullNameReversed function() {…

idea自动捕获_Smilefie:如何通过检测微笑来自动捕获自拍

idea自动捕获by Rishav Agarwal通过里沙夫阿加瓦尔 Smilefie&#xff1a;如何通过检测微笑来自动捕获自拍 (Smilefie: how you can auto-capture selfies by detecting a smile) Ten second takeaway: use Python and OpenCV to create an app that automatically captures a …

hiho 1015 KMP算法 CF 625 B. War of the Corporations

#1015 : KMP算法 时间限制:1000ms单点时限:1000ms内存限制:256MB描述 小Hi和小Ho是一对好朋友&#xff0c;出生在信息化社会的他们对编程产生了莫大的兴趣&#xff0c;他们约定好互相帮助&#xff0c;在编程的学习道路上一同前进。 这一天&#xff0c;他们遇到了一只河蟹&#…

React 组件绑定点击事件,并且传参完整Demo

微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 1.传数组下标给点击事件Demo&#xff1a; const A 65 // ASCII character codeclass Alphabet extends React.Component {constructor(props) {super(props);this.handleClick this.handleClick.bind…

ScaleYViewPager

https://github.com/eltld/ScaleYViewPager 转载于:https://www.cnblogs.com/eustoma/p/4572925.html

node mongoose_如何使用Express,Mongoose和Socket.io在Node.js中构建实时聊天应用程序

node mongooseby Arun Mathew Kurian通过阿伦马修库里安(Arun Mathew Kurian) 如何使用Express&#xff0c;Mongoose和Socket.io在Node.js中构建实时聊天应用程序 (How to build a real time chat application in Node.js using Express, Mongoose and Socket.io) In this tut…

结对项目开发电梯调度 - 整体设计

一、系统介绍 1&#xff0e; 功能描述 本电梯系统用来控制一台运行于一个具有16层的大楼电梯&#xff0c;它具有上升、下降、开门、关门、载客的基本功能。 大楼的每一层都有&#xff1a; (1) 两个指示灯: 这两个指示灯分别用于指示当前所在的层数和电梯的当前状态&#xff…

3.分支结构与循环结构

1 程序结构 程序结构分为顺序结构、分支结构、循环结构。分支结构有&#xff1a;if结构&#xff0c;if....else结构&#xff0c;if...else if....else &#xff0c;if...else结构&#xff0c;switch结构&#xff1b;循环结构有&#xff1a;while循环&#xff0c;do....while循环…

微信小程序 实现复制到剪贴版功能

微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 实现API&#xff1a; wx.setClipboardData(Object object) API说明&#xff1a;设置系统剪贴板的内容 属性类型默认值是否必填说明支持版本datastring 是剪贴板的内容 successfunction 否接口调用成功…

数据结构面试题编程题_您下次编程面试时应该了解的顶级数据结构

数据结构面试题编程题by Fahim ul Haq通过Fahim ul Haq Niklaus Wirth, a Swiss computer scientist, wrote a book in 1976 titled Algorithms Data Structures Programs.瑞士计算机科学家Niklaus Wirth在1976年写了一本书&#xff0c;名为《 算法数据结构程序》。 40 yea…

oracle使用小技巧

批量禁用触发器 SELECT ALTER TRIGGER || trigger_name || DISABLE; FROM all_triggers; 这样就生成了一个禁用语句列表&#xff0c;复制到sql脚本执行界面&#xff0c;批量执行即可&#xff0c;类似的&#xff0c;可以用all_tables来批量删除表。 转载于:https://www.cnblogs…

if for switch语句

顺序语句&#xff1a;一行行执行条件语句:选择分支if语句 1、 if&#xff08;....&#xff09;//括号内是判断条件 { //程序代码&#xff0c;运算等等 } 2、 if&#xff08;....&#xff09;//括号内是判断条件 { //程序代码&#xff0c;运算等等 } else//如果不满足条件则执…

Apache Unable to find the wrapper https - did you forget to enable it when you configured PHP?

微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 Apache Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? 问题解决办法&#xff1a; 打开配置文件 php.ini &#xff0c; 如图&#xff1a; …

文件魔术数字_如何使用魔术脚手架自动创建文件并节省时间

文件魔术数字Before we begin: This article uses JavaScript / Node.js example code, but you can port these concepts to any language using the right tools.开始之前&#xff1a;本文使用JavaScript / Node.js示例代码&#xff0c;但是您可以使用正确的工具将这些概念移…

Sql Server统计报表案例

场景&#xff1a;查询人员指定年月工作量信息 USE [Test] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER procedure [dbo].[GetWorkLoadMain] year int, month int, UserId varchar(50) as begindeclare day varchar(50)set dayCAST(year as varchar)-RIGHT((00…

运行报表时提示输入用户名和密码

在AX2012运行报表是总是提示用户输入用户名和密码&#xff1a; 尝试输入登陆名和密码&#xff0c;点击查看报表&#xff0c;出现如下错误&#xff1a; 因为AX2012的报表使用的针对AX2012客制化的SSRS&#xff0c;而要求输入登录名和密码是SSRS报表的数据源设置导致的。在SSRS管…