Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/06/2013, 10:01
rstory
 
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