Foros del Web » Programando para Internet » Jquery »

[SOLUCIONADO] json en jquery mobile

Estas en el tema de json en jquery mobile en el foro de Jquery en Foros del Web. Saludos. Tengo este codigo de un tutorial que estoy aprendiendo Código HTML: <html> <head> <link href= "http://code.jquery.com/mobile/latest/jquery.mobile.min.css" rel= "stylesheet" type= "text/css" /> <script type= "text/javascript" ...
  #1 (permalink)  
Antiguo 05/06/2013, 10:01
 
Fecha de Ingreso: junio-2003
Mensajes: 74
Antigüedad: 20 años, 10 meses
Puntos: 1
json en jquery mobile

Saludos.

Tengo este codigo de un tutorial que estoy aprendiendo

Código HTML:
<html>
<head>
 <link href="http://code.jquery.com/mobile/latest/jquery.mobile.min.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
        <script type="text/javascript" src="http://code.jquery.com/mobile/latest/jquery.mobile.min.js"></script>
</head>
<body>
	
	<script type="text/javascript">
/* <![CDATA[ */

(function($) {

$.fn.changeType = function(){

	var data = [
		{
		"department": "IT",
		"jobs": [
		        {"title":"Programmer"},
		        {"title":"Solutions Architect"},
		        {"title":"Database Developer"}
		        ]
		},
		{"department": "Accounting",
		"jobs": [
			    {"title":"Accountant"},
			    {"title":"Payroll Officer"},
			    {"title":"Accounts Clerk"},
			    {"title":"Analyst"},
			    {"title":"Financial Controller"}
			    ]
		},
		{
		"department": "HR",
		"jobs": [
			    {"title":"Recruitment Consultant"},
			    {"title":"Change Management"},
			    {"title":"Industrial Relations"}
			    ]
		},
		{
		"department": "Marketing",
		"jobs": [
			    {"title":"Market Researcher"},
			    {"title":"Marketing Manager"},
			    {"title":"Marketing Co-ordinator"}
			    ]
		}		        
		]

		var options_departments = '<option>Select<\/option>';
		$.each(data, function(i,d){
			options_departments += '<option value="' + d.department + '">' + d.department + '<\/option>';
		});
		$("select#departments", this).html(options_departments);
		
		
};
	
})(jQuery);


$(document).ready(function() {
	$("form#search").changeType();
});

/* ]]> */
</script>
<form id="search" action="" name="search">
	<select name="departments" id="departments">
		<option>Select</option>
	</select>
			
	</form>
</body>
</html> 
Pero ahora me gustaria cambiar los datos json que estan en el mismo archivo para que sean provenientes de otro dominio con

Código:
$.getJSON('http://dominio.com/archivo.json'
Gracias por todo

Etiquetas: html, javascript, js, json, mobile, select
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 05:19.