Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $.ajax({
- type: "POST",
- url: "Service.asmx/SELECT_ALL_CATEGORIAS",
- data: "{ EMP_ID: " + emp + ", UserName: '" + user + "', Password: '" + pass + "'}",
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- success: function (data) {
- debugger;
- if (!data) {
- alert('Fornecedor não encontrado. Por favor verifique e tente novamente.');
- } else {
- var tabela = $("#datagrid");
- var rows = "";
- tabela.find("tbody td").remove();
- var myData = data.d;
- for (var i = 0; i < myData.length; i++) {
- alert(myData.id);
- rows += "<tr>";
- rows += " <td>" + myData.id + "</td>";
- rows += " <td>" + myData.descricao + "</td>";
- rows += " <td>" + myData.filial_id + "</td>";
- rows += " <td> <input type='checkbox' /> </td>";
- rows += "</tr>";
- }
- tabela.find("tbody").html(rows);
- }
- },
- error: function (data) {
- debugger;
- alert('Error');
- }
- });
- return false;
- });
- });
- [WebMethod]
- // [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
- public string SELECT_ALL_CATEGORIAS(int EMP_ID, String UserName, String Password)
- {
- NegLogin login = new NegLogin();
- if (login.UserAuthentication(UserName, Password))
- {
- try
- {
- NegCategoria negCategoria = new NegCategoria();
- JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
- string json = string.Empty;
- json = jsSerializer.Serialize(negCategoria.SELECT_ALL_CATEGORIAS(EMP_ID));
- return json;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- else
- {
- return "Sem acesso ao conteúdo, verifique o usuário e senha!";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement