2014年4月24日
摘要: 除了使用$.getJSON或在Ajax请求中指定数据类型, 也可以解析一个有效的JSON字符串, 将它转换为JSON对象 var strJson=’{“name”:”XiaoMing”,”age”:8}’; var objJSON = jQuery.parseJSON(strJson); // 现在objJSON是一个JavaScript对象. 另一种方法(不建议使用)是使用eva... 阅读全文
posted @ 2014-04-24 23:05 思静 阅读(126) 评论(0) 推荐(0) 编辑
摘要: $(document).ready(function () { var jsonResult; $.get( 'json.php', displayData, //收到服务器响应... 阅读全文
posted @ 2014-04-24 22:59 思静 阅读(349) 评论(0) 推荐(0) 编辑
摘要: $json = travelDate; break; case JSON_ERROR_SYNTAX: echo 'Incorrect json : Please check your json syntax'; break; case JSON_ERROR_CTRL_CHAR: echo 'Control character error';... 阅读全文
posted @ 2014-04-24 22:54 思静 阅读(1682) 评论(0) 推荐(0) 编辑
摘要: JSON是JavaScript的原生数据格式, 它比XML更轻量快速. JSON对象以”{”开始和”}”结束, JSON中支持以下类型: 1. 对象, 对象是包含在”{”开始和”}”之间的一个键值对集合, 每个键值对之间以逗号分隔. 如 {“name”:”Xiao wang”,”Age”:8} 2. 数组: 数组的值以逗号分隔并包含在”[”和”]”之间, 如 [ {“name”:”X... 阅读全文
posted @ 2014-04-24 22:51 思静 阅读(283) 评论(0) 推荐(0) 编辑
摘要: $.ajax({ url: 'url.php', cache: false, success: function(data){ //..... }});仅Get有缓存, Post不会缓存 阅读全文
posted @ 2014-04-24 22:43 思静 阅读(199) 评论(0) 推荐(0) 编辑
摘要: $('input:button:first').click(function(aaa) { $.getScript('new.js', function() { alert('Script loaded'); ... 阅读全文
posted @ 2014-04-24 22:40 思静 阅读(212) 评论(0) 推荐(0) 编辑
摘要: $(document).ready(function () { $('input:button').click(function() { if($('#fileName').val() == '') { $('#resul... 阅读全文
posted @ 2014-04-24 22:39 思静 阅读(187) 评论(0) 推荐(0) 编辑
摘要: $('#loadFooter').click(function() { $('#footer').load('footer.html'); }); 阅读全文
posted @ 2014-04-24 22:35 思静 阅读(133) 评论(0) 推荐(0) 编辑
摘要: $(document).ready(function () { var ajax; $('#choice').change(function() { if(ajax) ... 阅读全文
posted @ 2014-04-24 22:34 思静 阅读(13688) 评论(0) 推荐(0) 编辑
摘要: $('input:button').click(function() { var data = $('form:first').serialize(); /* $.ajax( ... 阅读全文
posted @ 2014-04-24 22:32 思静 阅读(156) 评论(0) 推荐(0) 编辑
摘要: Jquery的serialize()方法用于将表单元素转换为查询字符串格式, Submit按钮及File选择元素是不能序列化的. $('input:button').click(function() { alert($('form:first').serialize()); ... 阅读全文
posted @ 2014-04-24 22:30 思静 阅读(183) 评论(0) 推荐(0) 编辑
摘要: $('#choice').change(function() { if($(this).val() != '') { $.get( 'data.php', ... 阅读全文
posted @ 2014-04-24 22:10 思静 阅读(265) 评论(0) 推荐(0) 编辑