javascript USES php code instances

  • 2020-05-05 10:53:33
  • OfStack

This article illustrates the use of php code in javascript. Share with you for your reference. The specific implementation method is as follows:


<script type="text/javascript" >
<?php if (!empty($searchResult)):?>
$.searchModule.init({display:<?php echo MAX_KEYWORDS_DISPLAY_COUNT; ?>,
mode:<?php echo $searchResult->mode; ?>,
query:'<?php echo (isset($keyword_assistant)?$keyword_queries:$keyword); ?>'});
$(document).ready(function(){
<?php if (isset($scroll_pos)): ?>
$(this).scrollTop(<?php echo $scroll_pos; ?>);
<?php endif; ?>
$.searchModule.checkSearchStatsRequest();
});
<?php else:?>
$.searchModule.init();
<?php endif;?>
</script>

I hope this article has been helpful to your javascript programming.


Related articles: