Use jQuery in external php file -
i have php file load php file jquery. works, moment start using jquery in 'external file', error 500. reason used approach because handy refresh data after ajax function.
this have:
test.php:
<script type="text/javascript" src="js/modernizr.custom.29473.js"></script> <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.js"></script> <script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script> $(function () { $(document).tooltip({ items: ".plupic , .ingr", content: function() { var element = $( ); if ( element.is( ".plupic " ) ) { var src = element.attr('src'); return "<img src='" + src + "' style='max-height: 300px; max-width: 300px;'>"; } if ( element.is( ".ingr" ) ) { var txt = element.text(); return txt; } } }); $('#kasticket').load('cart.php'); }); </script> </head> <body> <div class="container"> <div id="kasticket"></div><!-- load data jquery-->
cart.php:
i select database , write data table echo(); works perfectly, moment want use jquery, goes wrong...(i know sure because jquery works in local html file , putting line in comment makes php working again)
echo(" <script> jquery(document).ready(function() { if($('#l$myaant').width() < 70) { $('.tr1$myaant').show(); $('.tr2$myaant').hide(); }else{ $('.tr2$myaant').show(); $('.tr1$myaant').hide(); } }); </script> ");
i have no idea i'm doing wrong.
if help: http://www.itreflex.be/testacc/test.php (with jquery line in comment).
and cart.php, exported txt, long paste here.
hard tell without full source code have got couple of ideas:
first error 500 should http code internal server error, means error lies on server, on php side.
could possible mixing php , jquery on of other statements not posted here?
second, missed single quote on line
$('#kasticket').load(cart.php');
Comments
Post a Comment