获取html 中的内容 将前台的数据获取到后台
使用js创建一个form表单 ,使用post上传到后台中 下面是代码。在获取html内容的时候使用了js节点来获取内容。
parent:父节点。上一级的节点
siblings:兄弟节点。同一级别的节点

$(function(){
$('input[name=but]').click(function(){
var start=$(this).parent('div').siblings('div[name=qishi]').html();
var end=$(this).parent('div').siblings('div[name=mudi]').html();
var weight=$(this).parent('div').siblings('div[name=weight]').html();
var departid=$(this).parent('div').siblings('input[name=depart]').val();
// alert($(this).parent('div').siblings('div[name=qishi]')..html());
//调用
post('matching', {'start':start,'end':end,'weight':weight,'departid':departid});
});
});
function post(URL, PARAMS) {
var temp = document.createElement("form");
temp.action = URL;
temp.method = "post";
temp.style.display = "none";
for (var x in PARAMS) {
var opt = document.createElement("textarea");
opt.name = x;
opt.value = PARAMS[x];
// alert(opt.name)
temp.appendChild(opt);
}
document.body.appendChild(temp);
temp.submit();
return temp;
}
获取html 中的内容 将前台的数据获取到后台的更多相关文章
- 获取html 中的内容 将前台的数据获取到后台 用 jquery 生成一个 form表单 提交数据
使用js创建一个form表单 ,使用post上传到后台中 下面是代码.在获取html内容的时候使用了js节点来获取内容. parent:父节点.上一级的节点 siblings:兄弟节点.同一级别的节点 ...
- 使用Java或 JavaScript获取 方括号中的内容
1.使用Java获取方括号中的内容 String str = "[你]们,[我]们,[他]们,都要[好好学习,天天敲代码]"; Pattern p = Pattern.compil ...
- iPhone开发--正则表达式获取字符串中的内容
缘起: 想获取字符串中指定的字符,考虑用正则表达式,遂写了如下的代码: NSString *htmlStr = @"oauth_token=1a1de4ed4fca40599c5e5cfe0 ...
- 如何获取imageView中当前内容的相关信息并比较?
public class MainActivity extends Activity implements OnClickListener{ private Button button; privat ...
- json通过后台获取数据库中的内容,并在前端进行显示
fastjson.jar以及Echarts树图的js文件(需要在servlet对json进行赋值,所以需要用到json的插件) 链接:https://pan.baidu.com/s/1GBbamPNG ...
- yii框架通过http协议获取地址栏中的内容
//创建一个控制器 <?php namespace frontend\controllers; use frontend\models\Zhuce; use Yii; use yii\web\C ...
- springboot获取配置文件中的内容
代码: GrilApplication.java @SpringBootApplication public class GrilApplication { public static void ma ...
- 【python】获取网页中中文内容并分词
# -*- coding: utf-8 -*- import urllib2 import re import time import jieba url="http://www.baidu ...
- 原生JS获取li中的内容
随机推荐
- python3.5.2本地环境搭建
OS:win7 Download URL:https://www.python.org/downloads/release/python-352/ install 下载二进制安装文件之后,点击安装,一 ...
- [译]C#编码约定
原文:https://msdn.microsoft.com/en-us/library/ff926074.aspx 编码约定的目的是: 创建统一格式的代码,让读者的注意力更集中在内容上面,而不是结构 ...
- vtkTransform实例 1
1. 4*4矩阵类vtkMatrix4x4 接口函数:void SetElement(int i, int j, double value),i行.j列的值为value #ifndef INITIAL ...
- centos7 打开mysql 3306端口并 设置外部访问
mysql安装后默认是localhost访问,如果需要外部访问可以设置一个新的账号把host改为%,意味着所有ip均可以访问 grant all privileges on *.* to 'outUs ...
- json 使用 (下)
使用JSON JSON也就是JavaScript Object Notation,是一个描述数据的轻量级语法.JSON的优雅是因为它是JavaScript语言的一个子集.接下来你将看到它为什么如此重要 ...
- the operation was attempted on an empty geometry Arcgis Project异常
处理gis数据,投影变换时出现异常: the operation was attempted on an empty geometry 解决思路: arcgis的repair geometry方法:删 ...
- SubMenu的setHeaderView使用时发现的问题
SubMenu android.view.SubMenu.setHeaderView(View view) 上面是这个方法的完整签名,作用就是自定义子菜单的菜单头,但是在OptionsMenu里面设置 ...
- html5 json的新用法
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 【Network】TCPDUMP 详解
参考资料: https://www.baidu.com/s?ie=UTF-8&wd=tcpdump%20%E6%8C%87%E5%AE%9Aip tcpdump非常实用的抓包实例: http ...
- WPF去边框与webbrowser的冲突
首先建一个类,比如NativeMethods.cs class NativeMethods{ public const int WS_CAPTION=0x00C0000; public ...