Ajax : $. get()和$.post() $.getScript $.getJSON
<body>
<input type="button" value="Ajax" />
<div id="box"></div>
</body>
test.html
<span class="name">党兴明</span>
<span class="age">24</span>
test.php
<?php // if($_POST['age'] == 24){
// echo 'php:党兴明24';
// }else{
// echo '木有';
// } if($_GET['age'] == 24){
echo 'php:党兴明24';
}else{
echo '木有';
} ?>
test.xml
<?xml version="1.0"?>
<root>
<url>www.ycku.com</url>
</root>
test.josn
[
{
"url" : "www.ycku.com"
}
]
$. get():
//1 三种传值
$('input').click(function(){
$.get('test.php?age=24',function(response,status,xhr){
$('#box').html(response);
});
});
//2
$('input').click(function(){
$.get('test.php','age=24',function(response,status,xhr){
$('#box').html(response);
});
});
//
$('input').click(function(){
$.get('test.php',{
age:24
},function(response,status,xhr){
$('#box').html(response);
});
});
$.post()
//1 两种传值
$('input').click(function(){
$.post('test.php','age=24',function(response,status,xhr){
$('#box').html(response);
});
});
//
$('input').click(function(){
$.post('test.php',{
age:24
},function(response,status,xhr){
$('#box').html(response);
});
});
读取.xml和.josn文件:
$('input').click(function(){
$.post('test.xml',function(response,status,xhr){
$('#box').html($(response).find('root').find('url').text());
});
}); $('input').click(function(){
$.post('test.json',function(response,status,xhr){
$('#box').html(response[0].url);
});
});
$.getScript()
$('input').click(function(){
$.getScript('js/test.js');
});
$.getJSON()
$('input').click(function(){
$.getJSON('test.json',function(response,status,xhr){
$('#box').html(response[0].url);
});
});
Ajax : $. get()和$.post() $.getScript $.getJSON的更多相关文章
- jQuery 中的 Ajax $.ajax() load() $.get() $.post() $.getJSON() $.getScript()
1. $.ajax()方法 参数对象属性如下: 参数名 类型 描述 url String (默认: 当前页地址) 发送请求的地址. type String (默认: "GET") ...
- jQuery 之 $.get、$.post、$.getJSON、$.ajax
对 JSTL标签 加以巩固,同时在自己的博客中与之分享: http://app.yinxiang.com/shard/s20/sh/76feadb0-957a-40bc-895d-4d28025ce2 ...
- Flask与Ajax
这篇短文使用jquery. Flask提供一个很简单的方法来处理Ajax请求——在视图函数中用request的属性is_xhr来判断,如果是true则是异步请求. Jquery的$.getJSON() ...
- Asp.Net MVC 使用 Ajax
Asp.Net MVC 使用 Ajax Ajax 简单来说Ajax是一个无需重新加载整个网页的情况下,可以更新局部页面或数据的技术(异步的发送接收数据,不会干扰当前页面). Ajax工作原理 Ajax ...
- ABP文档 - Javascript Api - AJAX
本节内容: AJAX操作相关问题 ABP的方式 AJAX 返回信息 处理错误 HTTP 状态码 WrapResult和DontWrapResult特性 Asp.net Mvc 控制器 Asp.net ...
- [转载]Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法总结
本文对Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法进行了详细的总结,需要的朋友可以参考下,希望对大家有所帮助. 详细解读Jquery各Ajax函数: ...
- jQuery系列:Ajax
1. load(url, [data], [callback]) 1.1 解析 载入远程 HTML 文件代码并插入至 DOM 中. 语法格式: load(url, [data], [callback] ...
- getJson
$.getJSON("<%=basePath%>delivery/auditing.do",{Phones:Phones,currPage:currPage,timst ...
- jQuery的$.ajax
在介绍JSONP之前,先简单的介绍一些JSON.JSON是JavaScript Object Notation的缩写,是一种轻量的.可读的基于文本的数据交换开放标准.源于JavsScript编程语言中 ...
- 前端之ajax
前端之ajax 本节内容 ajax介绍 原生js实现ajax jquery实现ajax json 跨域请求 1. ajax介绍 AJAX(Asynchronous Javascript And XML ...
随机推荐
- ArcGIS api for javascript——显示地图属性
描述 本例展示了如哦读取地图和图层的属性和返回信息给用户.本例中的四个按钮允许用户接收地图属性.每个按钮调用不同的函数. ·Get All Map Layers - 这个按钮调用getMapLayer ...
- C++里面关于虚函数的一些注意点
最后,总结一下关于虚函数的一些常见问题: 1) 虚函数是动态绑定的,也就是说,使用虚函数的指针和引用能够正确找到实际类的对应函数,而不是执行定义类的函数.这是虚函数的基本功能,就不再解释了. 2) 构 ...
- mysql生成随机时间
mysql> update test set create_time=concat('2013-10-01 ', floor(10+rand()*10),':',floor(10+rand()* ...
- [React Native] Use the SafeAreaView Component in React Native for iPhone X Compatibility
In this lesson, you will learn how to use the SafeAreaView component to avoid the sensor cluster (th ...
- 使用spring-loaded开源项目,实现java程序和web应用的热部署
JDK1.5之后提供了java.lang.instrument.Instrumentation,即java agent机制可以实现类的redefinition和retransform. redefin ...
- Java之——删除ArrayList中的反复元素的2种方法
转载请注明出处:http://blog.csdn.net/l1028386804/article/details/47414935 ArrayList是Java中最经常使用的集合类型之中的一个.它同意 ...
- ddr sdram self-refresh & auto-refresh
以下是EDD5116AFTA数据手册的摘录.不过看过了还是不太明白二者的区别. self-refresh:Self-refresh entry [SELF]This command starts se ...
- 安装、配置Vmware Esx Server 3.5视频全过程
Vmware Esx server 的特点是它无需任何操作系统就可在硬件上运行,它的内核是VMware自己开发的VMkernel,可以理解成为Windows系统内核NTOSKRNL.另外它完全依靠Li ...
- WebApi 参数请求
收藏来源于:http://www.cnblogs.com/babycool/p/3922738.html 路由配置到id post多个参数 ➕前缀 FromBody 参数为实体 对于一般前台页面发起的 ...
- swing导出html到excel
swing导出html到excel 1 ShowCopDetal package com.product; import java.awt.BorderLayout; import java.awt ...