Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

The jQuery scripts I have in a DVWP do not get executed when I enable Asychronous Load in the Ajax Options of the DVWP. They do execute when I disable Asychronous Load though. Any thoughts on this?

A few scripts I refer to in the XSLT of the DVWP are:

<!-- Table sorting JS -->
<script type="text/javascript" src="/_layouts/somefolder/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="/_layouts/somefolder/fancybox/jquery.fancybox-1.3.1.js"></script>
<link rel="stylesheet" type="text/css" href="/_layouts/somefolder/fancybox/jquery.fancybox-1.3.1.css" media="screen" />
<link rel="stylesheet" href="/_layouts/somefolder/jquery.simplemenu.css" type="text/css" media="screen" />
share|improve this question
add comment

4 Answers

I am guessing you are using your jQuery in the document ready function.

You need to wrap your code in a function and add it to the built in SharePoint functions which are called after async postbacks:

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(functionName);

Reference: http://sharepointgoose.blogspot.com/2011/06/execute-code-after-asynchronous.html

share|improve this answer
add comment

Do they truly not execute or does it not give you the behaviour you were expecting?

Most likely your jQuery scripts run before your async data is loaded on the page. When the data arrives on the page, it will not be affected by the jQuery script that has already finished running.

share|improve this answer
add comment

I see you're referencing jquery plugins, but where is your Jquery Library Reference?

Jquery Plugins will fail if the Library is not loaded before them. Cheers

share|improve this answer
add comment

Try using the "defer"="defer" attribute in your script tags.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.