javascript - jQuery ajax doesn't work with last version of chrome -
hey guys, have little problem simple ajax request. can't figure out why jquery ajax method doesn't work last version of chrome ... on ff work great on opera on chrome don't response , no errors. js code:
function load(idno){ var url = 'index.php'; $.get( url, { pagina:"ajax", show:"cars", brand:idno }, function(data) { document.getelementbyid("model").innerhtml=data }, "html" ); }
any reason you're not using jquery.load()
? eg
$('#model').load('index.php', { pagina: 'ajax', show: 'cars', brand: idno });
at guess, i'd problem innerhtml
call. more robust method use jquery.html()
, eg
function(data) { $('#model').html(data); }
edit
just whipped test , works fine
<?php // test.php echo '<pre>', print_r($_request, true), '</pre>';
<!-- test.html --> <!doctype html> <html> <head> <title></title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body> <div id="model"> default text </div> <p><button id="fetch-data">fetch data</button></p> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script> <script type="text/javascript"> jquery(function($) { $('#fetch-data').click(function() { $('#model').load('test.php', { pagina: 'ajax', show: 'cars', brand: 123 }); return false; }); }); </script> </body> </html>
when click button, can see request variables sent script
Comments
Post a Comment