Мой текущий код такой. index.php <script type="text/javascript" src="jquery-1.4.2.js"></script> <script type="text/javascript" src="ajax.js"></script> <select id="dropdown_id"> <option value="one.php">One</option> <option value="two.php">Two</option> </select> <div id="workspace">workspace</div> one.php $arr = array ( "workspace" => "One" ); echo json_encode( $arr ); two.php $arr = array( 'workspace' => "Two" ); echo json_encode( $arr ); JS jQuery('#dropdown_id').live('change', function(event) { jQuery.getJSON($(this).val(), function(snippets) { for(var id in […]
index.php <script type="text/javascript" src="jquery-1.4.2.js"></script> <script type="text/javascript" src="ajax.js"></script> <a href='one.php' class='ajax'>One</a> <a href='two.php' class='ajax'>Two</a> <div id="workspace">workspace</div> one.php $arr = array ( "workspace" => "One" ); echo json_encode( $arr ); two.php $arr = array( 'workspace' => "Two" ); echo json_encode( $arr ); ajax.js jQuery(document).ready(function(){ jQuery('.ajax').live('click', function(event) { event.preventDefault(); // load the href attribute of the link that […]