echoing javascript when an ajax funtion is called

Posted by Roland on Stack Overflow See other posts from Stack Overflow or by Roland
Published on 2010-06-13T06:18:10Z Indexed on 2010/06/13 6:22 UTC
Read the original article Hit count: 452

Filed under:
|
|

I'm doing a ajax call via the normal jquery ajax funtion

My ajax looks as follows

jQuery('#yt10').live('click',function(){jQuery.ajax({'data':{'set':$("#booking_set_id1").val(),'setStat':$("#booking_stockStatus").val(),'setNum':$("#booking_setNum").val()},'beforeSend':function(){
                            if($("#booking_set_id1").val() == "" || $("#booking_stockStatus").val() == "" || $("#booking_setNum").val() == ""){
                                $("#error").addClass("flash-error");
                                $("#error").html("Please fill in all relevant set details before adding a set");
                                return false;
                            }
                           },'dataType':'html','success':function(data,status){
                                    $("#mainrow").show();
                                $("#error").removeClass("flash-error");
                                $("#error").html("");
                                $("#setTable tr:last").after(data);
                                $("#booking_set_id1").val("");
                                $("#booking_stockStatus").val("");
                                $("#booking_setNum").val("");
                            },'url':'/booking/newSet','cache':false});return false;});

Now the function newSet needs to echo javascript to the bowser but somehow jquery filters the javscript out. Is it possible to echo javascript via ajax

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX