Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 10, 2013 09:49 PM by alvaro_web
Member
121 Points
172 Posts
Jan 10, 2013 06:10 PM|LINK
Using VS2010, aspnet, c# jquery and ajax
I have a function that consumes a web service
$.ajax({ url: "BuscaObjetoPai.asmx/Pesquisar", data: "{'parametro1': '" + (pai[1]) + "' }", dataType: "json", type: "POST", contentType: "application/json; charset=utf-8", dataFilter: function (data) { return data; }, success: function (msg) { var teste = (msg.d); var objetopai = teste.split("-"); // HERE GIVES AN ERROR: Object does not support property or method 'split' $("#txtEmailPai").val(objetopai[0]); $("#txtRgPai").val(objetopai[1]); } }); -------- method ----------- public List<string> Pesquisar(string parametro1) { Responsavel responsavel = this.acaoResponsavel.ObterUnico(p => p.Cpf.Equals(parametro1)); List<string> nomes = new List<string>(); string nome = (responsavel.Email.ToString() +'-'+ responsavel.Rg.ToString()); nomes.Add(nome); return nomes; }
612 Points
149 Posts
Jan 10, 2013 06:18 PM|LINK
Have you tried debugging to see what msg.d is returning ?
Jan 10, 2013 09:49 PM|LINK
var teste = (msg.d); var objetopai = teste[0].split("-"); $("#txtEmailPai").val(objetopai[0]); $("#txtRgPai").val(objetopai[1]);
alvaro_web
Member
121 Points
172 Posts
jquery and ajax
Jan 10, 2013 06:10 PM|LINK
Using VS2010, aspnet, c# jquery and ajax
I have a function that consumes a web service
$.ajax({ url: "BuscaObjetoPai.asmx/Pesquisar", data: "{'parametro1': '" + (pai[1]) + "' }", dataType: "json", type: "POST", contentType: "application/json; charset=utf-8", dataFilter: function (data) { return data; }, success: function (msg) { var teste = (msg.d); var objetopai = teste.split("-"); // HERE GIVES AN ERROR: Object does not support property or method 'split' $("#txtEmailPai").val(objetopai[0]); $("#txtRgPai").val(objetopai[1]); } }); -------- method ----------- public List<string> Pesquisar(string parametro1) { Responsavel responsavel = this.acaoResponsavel.ObterUnico(p => p.Cpf.Equals(parametro1)); List<string> nomes = new List<string>(); string nome = (responsavel.Email.ToString() +'-'+ responsavel.Rg.ToString()); nomes.Add(nome); return nomes; }Specs
Member
612 Points
149 Posts
Re: jquery and ajax
Jan 10, 2013 06:18 PM|LINK
Have you tried debugging to see what msg.d is returning ?
alvaro_web
Member
121 Points
172 Posts
Re: jquery and ajax
Jan 10, 2013 09:49 PM|LINK
var teste = (msg.d); var objetopai = teste[0].split("-"); $("#txtEmailPai").val(objetopai[0]); $("#txtRgPai").val(objetopai[1]);