Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/08/2013, 05:28
AJDC
 
Fecha de Ingreso: agosto-2003
Mensajes: 324
Antigüedad: 20 años, 9 meses
Puntos: 1
Recuperar valores devueltos en consulta AJAX

Hola.
tengo un código JQuery que hace uso de un webservice, el cual me retorna una cadena con los valores que tengo que recuperar.

La llamada que realizo es:
Código:
$.ajax({
	            type: 'GET',
	            url: urlWSBase + '/ProductCategory?_where=id%20in%20(%20select%20distinct%20p.productCategory%20from%20Product%20p%20where%20purchase%20=%20true%20)&_sortBy=name&callback=callback',
		    contentType: 'application/json', 
	            dataType: 'jsonp',
	            username: 'xxxx',
	            password: 'xxxx',
	            crossDomain: true,
	            jsonp: false,
	            jsonpCallback: 'callback',
	            success: function(data) {

			$("#campo1).get(0).options.length = 0;
            		$("#campo1).get(0).options[0] = new Option("Seleccione categoría", "-1");   
 
		            $.each(data.d, function(index, item) {          $("#campo1).get(0).options[$("campo1).get(0).options.length] = new Option(item.Display, item.Value);
		         });
				},
	            error: function (httpReq,status,exception){
        				alert("Error al cargar las categorias de productos");
	            }
El valor que me devuelve el webservice es:
Código:
callback({"response":{"startRow":0,"endRow":0,"data":[{"_identifier":"Azul claro","_entityName":"ProductCategory","$ref":"ProductCategory\/5D5B60983EE34C859DC79D400B1BFC1B","id":"5D5B60983EE34C859DC79D400B1BFC1B","client":"4D4719F95EF1408D935D33F554A29E16","client$_identifier":"aaa-1","organization":"0","organization$_identifier":"*","active":true,"creationDate":"2013-08-09T12:55:44+02:00","createdBy":"4748C3D537674ED6948B5D1F9AC7F3A9","createdBy$_identifier":"aaa-1Admin","updated":"2013-08-09T12:55:44+02:00","updatedBy":"4748C3D537674ED6948B5D1F9AC7F3A9","updatedBy$_identifier":"aaa-1Admin","searchKey":"Azul claro","name":"Azul claro","description":"Categoría Azul claro","default":false,"plannedMargin":0,"assetCategory":null,"image":null,"summaryLevel":false,"recordTime":1376905656037}],"status":0}})
¿Cómo puedo interpretar y recuperar determinados valores?¿Recuperar por ejemplo el valor 'name' e 'id'?
Gracias