Thank you Mike - I'd inadvertantly dropped the interface.js file from
the head section.
And thanks also for the ajaxError tip - it'll help me in the future.
Cheers,
Bruce
At 01:47 a.m. 17/07/2007, you wrote:
Bruce,
You've got a scripting error on your callbacks. "ScrollTo" is not a
defined plugin method (you've used it in multiple places). Did you
mean to use "scrollTop"?
Also, to catch errors in async callbacks bind an error handler using
ajaxError:
$().ajaxError(function(ev, xhr, opts, err){
alert(err);
})
Cheers.
Mike
On 7/16/07, Bruce MacKay <[EMAIL PROTECTED]> wrote:
Hi Mike,
A sample page is here:
http://horticulture227.massey.ac.nz/admin/prolearn13.asp?id=1&which=2
Click on the [view student list] link (the 'class=gao' link); the [view
search options] link which replaces it is unbound - despite my best attempts
to re-bind.
Thanks,
Bruce
original message.....
Hello folks,
I'm having difficulty rebinding both a form submit and a click function
upon return of an ajax call.
The onload code is ...
$(document).ready(function() {
$("a.gao").bind("click", function() {getAllOptions()});
var options = {dataType: 'html', before: beforeAjax,after: afterAjax};
$('#getStudentInfo').submit(function()
{$(this).ajaxSubmit(options);return false; });
});
function beforeAjax(html) { $("#comments3").hide();}
function afterAjax(html) {
$("#sDetails").html(html).fadeIn(800).ScrollTo(800).highlightFade({color:'yellow',speed:2000,iterator:'linear'});
tb_init('a.thickbox');
}
When I click the class="gao" link, the following call is made...
function getAllOptions() {
$.ajax({
type: 'GET',
url:
'scripts/ajax_studentroll.asp?w=allselect&rand=' + new
Date().getTime(),
dataType: "html",
success: function(html){
$('#sDetails').hide(600);
$("#flipdisplay").html(html).fadeIn(800).ScrollTo(800).highlightFade({color:'yellow',speed:4000,iterator:'linear'});
$('#getStudentInfo').unbind('submit');
$("a.gao").unbind("click");
var options = {dataType: 'html', before: beforeAjax,after:
afterAjax};
$('#getStudentInfo').submit(function()
{$(this).ajaxSubmit(options);return false; });
$("a.gao").bind("click", function() {getSearchOptions()});
}
});
}
The html that is correctly returned, but I cannot get the new class="gao"
link or the form (id=getStudentInfo) within that html block to be re-bound
for subsequent action.
As you can see, I've tried to unbind the functions before binding them
again, but I must still doing something wrong as this wasn't successful.
At 12:45 a.m. 10/07/2007, you wrote:
Bruce,
Do you have a sample page we can look at? I don't see anything
obviously wrong with the code, but it's hard to tell without seeing
more of the page.
Mike
I'm having difficulty rebinding both a form submit and a click function
upon return of an ajax call.