Kissy中的ajax异步提交

参考文献  http://docs.kissyui.com/1.1.6/ajax/
var S=KISSY;
S.io({
          type:'POST',
          url:'interface.jsp',
          data:null,
          success:function(data,textStatus,xhr)
          {
               //callback
          },
          dataType:'xml'
});
比如兴哥在user中的regist下的
S.Event.on('#submit','click',function()
{
  new IO(
{
     url:"{path}/user/confirmRegist.do",
     data:
     {
          email:S.all('#email').val(),
          username:S.all('#username').val()
     },
     type:'get',
     dataType:'json',
     success:function(data)
     {
          if(!data.isCanRegist)
          {
               alert(data.error);
          }
     }
}) ; 
});

Kissy中的ajax异步提交_第1张图片



像现在我们想在当点击确定这个button的时候进行一个Ajax异步的提交,那么我们需要找到后台的脚本,进行一个new IO
首先我们找到这个脚本


Kissy中的ajax异步提交_第2张图片


当点击的时候已经绑定了一个函数,接着我们进行编码、


_event.on(_enter, "click", function (S) {
                //TODO 2014-05-30 basilwang need to submit
                // _dom_id_J_FForm.submit();
            new IO(
            {
            type:'Get',
            url:"/JavaWebFrame/sports/index.do",
            data:
            {
            step:7000
            },
            //dataType:'json',
            success:function(data)
            {
            alert("success");
            }
            });
           
Kissy中的ajax异步提交_第3张图片

      _event.on(_enter, "click", function (S) {
                //TODO 2014-05-30 basilwang need to submit
                // _dom_id_J_FForm.submit();
            new IO(
            {
            type:'Get',
            url:"/JavaWebFrame/sports/index.do",
            data:
            {
            step:7000
            },
            //dataType:'json',
            success:function(data)
            {
            alert("success");
            }
            });
           






回调函数显示成功,具体需要在后台进行参数的配置,controller中的方法的完善。






你可能感兴趣的:(kissy)