zoukankan      html  css  js  c++  java
  • 20151209jquery学习笔记Ajax 代码备份

    /*$(function () {
    	$("input").click(function() {
            $.ajax({
    			type:'POST',
    			url:'test.php',
    			data:{
    				url:'ycku'
    				},
    				success: function(response,status,xhr){
    					$("#box").html(response);
    					}
    			});
        });
    });
    
    
    
    $(function () {
    	$('form input[type=button]').click(function() {
            $.ajax({
    			type:'POST',
    			url:'user.php',
    			data:{
    				user:$('input[name=user]').val(),
    				email:$('input[name=email]').val()
    				},
    				success: function(response,status,xhr){
    					$("#box").html(response);
    					}
    			});
        });
    });
    */
    /*表单序列化*/
    $(function () {
    	/*$('form input[type=button]').click(function() {
            $.ajax({
    			type:'POST',
    			url:'user.php',
    			data:$("form").serialize(),
    				success: function(response,status,xhr){
    					$("#box").html(response);
    					}
    			});
    			alert($('form').serialize());//字符串形式的键值对,并且还对URL进行了编码
        });
    	$('form input[name=sex]').click(function() {
           //$('#box').html(decodeURIComponent($(this).serialize()))
    	   // $('#box').html($(this).serializeArray())
    	   //console.log($('#box').html($(this).serializeArray()))
    	   var json=$(this).serializeArray();
    	   $('#box').html(json[0].name+'='+json[0].value());
        });
    	$('form input[type=button]').click(function() {
    		//初始化重复的属性
    		$.ajaxSetup({
    				type:'POST',
    			    url:'user.php',
    			    data:$("form").serialize(),
    				});
            $.ajax({
    				success: function(response,status,xhr){
    					$("#box").html(response);
    					}
    			});
    			
    			
        });
    	*/
    	$('form input[type=button]').click(function() {
            $.ajax({
    			type:'POST',
    			url:'user.php',
    			data:$.param({
    				user:$('input[name=user]').val(),
    				email:$('input[name=email]').val()
    				}),
    				success: function(response,status,xhr){
    					$("#box").html(response);
    					}
    			});
        });
    });
    

      

  • 相关阅读:
    原来是板子的硬件问题
    最简单的helloworld模块编译加载(linux3.5内核源码树建立)
    排序学习笔记
    配置开发环境遇到的一些问题及解决方法
    .NET基础之GridView控件
    .NET之页面数据缓存
    .NET基础之Calendar控件
    【转帖】DIV+CSS完美兼容IE6/IE7/FF的通用方法
    ADO.NET()Command
    .NET基础之DataList控件
  • 原文地址:https://www.cnblogs.com/xiaoduc-org/p/5034049.html
Copyright © 2011-2022 走看看