<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的更多相关文章

  1. jQuery 中的 Ajax $.ajax() load() $.get() $.post() $.getJSON() $.getScript()

    1. $.ajax()方法 参数对象属性如下: 参数名 类型 描述 url String (默认: 当前页地址) 发送请求的地址. type String (默认: "GET") ...

  2. jQuery 之 $.get、$.post、$.getJSON、$.ajax

    对 JSTL标签 加以巩固,同时在自己的博客中与之分享: http://app.yinxiang.com/shard/s20/sh/76feadb0-957a-40bc-895d-4d28025ce2 ...

  3. Flask与Ajax

    这篇短文使用jquery. Flask提供一个很简单的方法来处理Ajax请求——在视图函数中用request的属性is_xhr来判断,如果是true则是异步请求. Jquery的$.getJSON() ...

  4. Asp.Net MVC 使用 Ajax

    Asp.Net MVC 使用 Ajax Ajax 简单来说Ajax是一个无需重新加载整个网页的情况下,可以更新局部页面或数据的技术(异步的发送接收数据,不会干扰当前页面). Ajax工作原理 Ajax ...

  5. ABP文档 - Javascript Api - AJAX

    本节内容: AJAX操作相关问题 ABP的方式 AJAX 返回信息 处理错误 HTTP 状态码 WrapResult和DontWrapResult特性 Asp.net Mvc 控制器 Asp.net ...

  6. [转载]Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法总结

    本文对Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法进行了详细的总结,需要的朋友可以参考下,希望对大家有所帮助. 详细解读Jquery各Ajax函数: ...

  7. jQuery系列:Ajax

    1. load(url, [data], [callback]) 1.1 解析 载入远程 HTML 文件代码并插入至 DOM 中. 语法格式: load(url, [data], [callback] ...

  8. getJson

    $.getJSON("<%=basePath%>delivery/auditing.do",{Phones:Phones,currPage:currPage,timst ...

  9. jQuery的$.ajax

    在介绍JSONP之前,先简单的介绍一些JSON.JSON是JavaScript Object Notation的缩写,是一种轻量的.可读的基于文本的数据交换开放标准.源于JavsScript编程语言中 ...

  10. 前端之ajax

    前端之ajax 本节内容 ajax介绍 原生js实现ajax jquery实现ajax json 跨域请求 1. ajax介绍 AJAX(Asynchronous Javascript And XML ...

随机推荐

  1. [Poi] Setup PostCSS and Tailwind with Poi

    This lesson walks through setting up a Poi project using PostCSS and the popular Tailwind library fo ...

  2. python list的+,+=,append,extend

    面试题之中的一个. def func1(p): p = p + [1] def func2(p): p += [1] p1 = [1,2,3] p2 = [1,2,3] func1(p1) func2 ...

  3. Xcode加入应用图标以及启动界面

    寻找了许久的资料,记录下Xcode加入应用图标以及启动界面的学习笔记: 很实用的网址: 1.(苹果官网)Designing for iOS 2.iOS 8 人机交互指南 图标和图片的尺寸參考: 更加具 ...

  4. Windows cannot find ". Make sure you typed the name correctly, and then try again

    https://answers.microsoft.com/en-us/windows/forum/windows_10-desktop/windows-10-explorerexe-error-wi ...

  5. html&css基础笔记

    有道笔记:http://note.youdao.com/noteshare?id=a6d7eab195085655bbfce86665524e35 一 HTML结构标签 HTML基本标签 标题标签 & ...

  6. POJ 3275 两种做法

    题意: 思路: 1.Floyd传递闭包 n^3/32 勉强卡过去吧-- 2.用邻接表搞Floyd 也是勉强卡过去-- 最后用n*(n-1)-矩阵中为1的个数就OK了 传递闭包: //By Sirius ...

  7. IBM软件技术峰会归来

    为期两天在北京国际饭店会议中心的IBM软件技术峰会已近结束,此次大会最大的收获是能和沃森实验室的王博士沟通探讨人工智能软件的发展问题.领略到IBM 云计算首席架构师Jason R.McGee如何呼风唤 ...

  8. 局域网ARP病毒的清理

    局域网ARP病毒的清理 作者:IT动力源  来源:IT动力源收集整理     现在局域网中感染ARP 病毒的情况比较多,清理和防范都比较困难,给不少的网络管理员造成了很多的困扰.下面就是个人在处理这个 ...

  9. Linux下解压缩文件命令总结

    ---------------------------------------------tar命令: -v 可视化-c 新建包-f 指定文件名(除非你用默认用户名)-x 解压target.tar-r ...

  10. Flex XML/XMLList 常用操作

    1       XML.XMLList操作 Flex对xml提供了很多强大而灵活的操作.相对于其他语言,flex对xml的格式要求不那么苛刻,只要符合基本格式语法的字符串,flex能非常简单的转换成x ...