hi !! yes :) :) just get "prototype.js" . don't upload it into ur
html/php page ==>
just link your  jquery framework
annd  it's gonna b the magic of xhr so my solution is like this !!

1- Replace all the $ of jquery code with jQuery to get any conflict
2- and create a functio like send_my_form()

{
// get all your variables with $var1 = jQuery('#var1_id").val();
//the most important step is to force the prototype request with a
nice call to prototype.js with :

jQuery.getScript("lib/prototype.js", function(){
var d = new Date();

var url = 
"saveform.php?qname="+nqn+"&id="+fid+"&title="+ftitle+"&operation="+fop+"&script_admin="+fadmin+"&qhelp="+nqh+"&qtype="+nqt+"&data="+htmla+"&dt="+d.getMilliseconds();
new Ajax.Request(url, {
  method: 'get',
  onSuccess: function(transport) {
    var notice = $('results2');
    if (transport.responseText != "" ){
                        //alert(transport.responseText); // u can take ur 
response text to
do something else ;)
                        eval(transport.responseText);//notice.update(' Succees 
!!
').setStyle({ background: '#dfd' });
        }
    else{notice.update(' Errort !!').setStyle({ background: '#fdd' });}
  },
  onFailure: function(transport) {
    var notice = $('results2');notice.update(' Error !!').setStyle({
background: '#fdd' });
  }
});
});

}


wiith this example i hope that u understand me and my code lol


2009/5/30, BalusC <bal...@gmail.com>:
>
> OK, I solved it as following:
>
> [code]
> $('#myform').ajaxSubmit({
>     error: function(xhr) {
>         document.open();
>         document.write(xhr.responseText);
>         document.close();
>     },
>     success: doSomething
> });
> [/code]
>
> Isn't there a "nice" jQuery way of doing this anyway?
>
> Cheers, B
>
>
> On May 29, 11:13 pm, BalusC <bal...@gmail.com> wrote:
>> The server side (JSP/Servlet in this case) can throw an unexpected
>> exception (ServletException in this case). The exception is on the
>> server side handled as an error page, which returns just a complete
>> HTML page with the exception details. I'd like to let ajaxSubmit's
>> error option show the entire page. With other words, it must handle it
>> as synchronous response rather than asynchronous response.
>>
>> I can't manage to get it to work. I tried under each the following:
>>
>> [code]
>> $('#myform').ajaxSubmit({
>>     error: function(xhr) { $(document).html(xhr.responseText); },
>>     success: doSomething});
>>
>> [/code]
>> Unfortunately this displays a blank document, although alert
>> (xhr.responseText) shows the correct and complete HTML response.
>>
>> But to my surprise this works:
>> [code]
>> $('#myform').ajaxSubmit({
>>     error: nonExistingFunctionName,
>>     success: doSomething});
>>
>> [/code]
>> This works exactly as if it was a synchronous request. This also shows
>> an error "nonExistingFunctionName is not defined" in the JS error
>> console. But the big pitfall is that the success part (and the remnant
>> of the JS code) won't be executed anymore due to the same error as it
>> is apparently been interpreted anyway. So if no exception is been
>> thrown, nothing will happen anymore.
>>
>> Any insights? How could I show the xhr.responseText as if it was a
>> synchronous response?
>

Reply via email to