jQuery & Ajax

jQuery & Ajax

Hi Developers,

I'm having a small problem while using Ajax. Well, this might not appear as jQuery problem, but any advice will be appreciated.

I've a dropdown list displaying problem IDs in my page. Based on the ID selected, the problem statement (HTML code fragment) is loaded from the database, and displayed in another <div> using $.load(). There is absolutely no problem with this.

The problem is, I'm using SyntaxHighlighter to highlight the problem statement (C code). This highlighting thing is not working. I've another page where entire contents get loaded when the page is loaded -- there the syntax highlighting is working fine.

Could anyone plz help?

Snippets of code are given below:

 -- exercise.html
  1. <script type="text/javascript" src="{{ MEDIA_URL }}lib/SyntaxHighlighter/scripts/shCore.js"></script>
  2.     <script type="text/javascript" src="{{ MEDIA_URL }}lib/SyntaxHighlighter/scripts/shBrushBash.js"></script>
  3.     <script type="text/javascript" src="{{ MEDIA_URL }}lib/SyntaxHighlighter/scripts/shBrushCpp.js"></script>
  4.     <!--<script type="text/javascript" src="{{ MEDIA_URL }}lib/SyntaxHighlighter/scripts/shBrushCss.js"></script>-->
  5.     <!--<script type="text/javascript" src="{{ MEDIA_URL }}lib/SyntaxHighlighter/scripts/shBrushJScript.js"></script>-->
  6.     <!--<script type="text/javascript" src="{{ MEDIA_URL }}lib/SyntaxHighlighter/scripts/shBrushXml.js"></script>-->
  7.     <link type="text/css" rel="stylesheet" href="{{ MEDIA_URL }}lib/SyntaxHighlighter/styles/shCore.css"/>
  8.     <link type="text/css" rel="stylesheet" href="{{ MEDIA_URL }}lib/SyntaxHighlighter/styles/shThemeDefault.css"/>
  9.     <script type="text/javascript">
  10.         SyntaxHighlighter.config.clipboardSwf = 'scripts/clipboard.swf';
  11.         SyntaxHighlighter.all();
  12.     </script>
-- The HTML that is obtained by Ajax call

<p><strong>Find all the linearly independent paths for the following program:</strong></p>

  1. <p>
  2. <pre style="text-align: left;" class="brush: c;">
  3. // Initialize elements of a 2D array to 0
  4. for (i = 0; i < nr; i++) {
  5. &nbsp;&nbsp;&nbsp;&nbsp;for (j = 0; j < nc; j++) {
  6. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a[i][j] = 0;
  7. &nbsp;&nbsp;&nbsp;&nbsp;}
  8. }
  9. return;
  10. </pre>
  11. </p>
Thanks!