2013-07-25 2 views
0

.each 클래스를 사용하고 gridview의 rowData를 하나씩 ajaxsubmit에 제출하여 gridview를 반복합니다.jquery 함수에 행 데이터 전달하기

모든 것이 잘 작동하는 것 같습니다. var rowData를 제외하고 나는 ajaxsubmit에 그것을 전달하는 방법을 모른다. "#rowData"를 사용하여 시도했지만 작동하지 않습니다.

$("#submit").click(function() { 
       var record; 
       alert("starting"); 
       $("#<%=GridView3.ClientID%> input[id*='chkEmployee']:checked").each(function() { 
        var rowData = { 
         "privateID": $(this).closest('tr').find('.IDName').text(), 
         "Company": $(this).closest('tr').find('.FName').text(), 
         "Dun": $(this).closest('tr').find('.DName').text() 
        }; 
         $("#rowData").ajaxsubmit(
          "./employeeAdd" 
          , function() { 
           jInfo("data base been sumitted" 
           } 
          ); 
          }); 
        }); 

누구든지 rowData를 ajaxsubmit에 제대로 전달하는 방법을 알고 있습니까? 감사합니다

답변

0
$("#submit").click(function() { 
var record; 
alert("starting"); 
$("#<%=GridView3.ClientID%> input[id*='chkEmployee']:checked").each(function() { 
$.ajax({ 
    type: "POST", 
    url: "Post.aspx/savePost", 
    data: "{privateID:'" + $(this).closest('tr').find('.IDName').text() + "',Company:'" + $(this).closest('tr').find('.FName').text() + "',Dun:'" +$(this).closest('tr').find('.DName').text()}", 
    contentType: "application/json", 
    dataType: "json", 
    success: function (data) { 
     if (data == undefined) { 
      alert("Error : 219"); 
     } 
     else { 
      alert(data.d); 
     } 
    }, 
    error: function (data) { 
     if (data == undefined) { 
      alert("Error : 465"); 
     } 
     else { 
      alert("Error : 468 " + data.d); 
     } 
    } 
});     
}); 
}); 
0

당신은 "ajaxSubmit" JQuery 플러그인을 말하는 겁니까? 당신이 HTML 양식이있는 경우 그 유용하지만 여기에 이미 포스트 데이터를 - 바로 사용 JQuery post :

$.post("./employeeAdd", rowData, function() { 
    jInfo("submitted"); 
});