• 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);
    					}
    			});
        });
    });
    

      

  • 相关阅读:
    android spinner学习
    cookie的学习笔记三(做俩个小练习);
    Cookie的细节具体保存的有效时间
    cookie技术核心! 就是四个类的应用 搞懂这个基本上就把这个搞定了!
    学习Servlet的重要应用 在什么地方用写路径
    数组空值empty
    ios学习杂记
    ios广告封装
    Runtime
    UIImage分类,设置边框
  • 原文地址:https://www.cnblogs.com/xiaoduc-org/p/5034049.html
Copyright © 2020-2023  润新知