jquery focus not working on a page loaded with ajax

前端 未结 3 560
灰色年华
灰色年华 2021-01-28 00:41

My code

index.php





        
3条回答
  •  梦如初夏
    2021-01-28 01:18

    You do not need to display the html code in go.php after you finish processing the POST data

    Try this

    $(document).ready(function() {
      $("#verifica").click(function(){
      $("#risultati").html("Please wait...");
        $.ajax({
          type: "POST",
          url: "go.php",
          data: $("#ciao").serialize(),
          //dataType: "html",
          success: function(msg)
          {
            $("#risultati").html(msg);
            $("#zio").focus();
          },
          error: function()
          {
              $("#risultati").html("An error occurred.");
          }
        });
      });
    });
    

提交回复
热议问题