Newbie question

Newbie question

Hi

I inherited this jQuery code;

  1. jQuery("#login-form").submit(function(){
  2. var str = jQuery(this).serialize();
  3. jQuery.ajax({
  4.   type: "POST",
  5.   url: "includes/login-send.php",
  6.   data: str,
  7.   success: function(msg)
  8.   {
  9. jQuery("#formstatus").ajaxComplete(function(event, request, settings){
  10. if(msg == 'OK'){ 
  11. window.location.href = "index.php";
  12. } else{
  13. var openingTag='<div class="formstatuserror">';
  14. var closingTag="</div> ";
  15. result = openingTag.concat(msg,closingTag); 
  16. }
  17. jQuery(this).html(result);  <===== Error here
  18. });
  19. }
  20. });
  21. return false;
  22. });
I am getting '0x800a1391 - JavaScript runtime error: 'result' is undefined' error on;

  1. jQuery(this).html(result);

What am I doing wrong?

Thanks