Colorbox - how to open a submitted form in a colorbox popup?

I have a form on a web page. When the user enters the input into the form and removes Submit, I would like the colorbox to appear on the results page.

Any ideas on how to do this?

I think I need to convert the form data into a get string, put it at the end of the url to open, and then send it to colorbox. Is this correct, or is there an easier way?

Thank:)

+3
source share
1 answer

For this, I would:

  • Manually submit the form by serializing the form as an array
  • Then send the data with get, postor ajax.
  • div, colorbox div.

:

$("#myForm").submit(function(){
    var formData = $(this).serializeArray();
    $.get("mypage", formData, function(r){
        $("body").append("<div id='response'></div>");
        $("#response").hide().html(r).colorbox();
    });
    return false; // To override non-ajax submitting
});

, :

  • get post ajax
  • div, (, div , response )

:

, get, put url, , colorbox.

, get. get , CSRF XSS.

+3

Source: https://habr.com/ru/post/1766580/


All Articles