oleg.foreigner
oleg.foreigner

Reputation: 1023

Submit form from javascript with form url

I have a button. And I have a form that calls celery task. form has url, smth like

http://example.com/export/?user=user123&timedelta=10

I need to submit this form from confirm dialog.
How it should work... In user profile admin presses a button, javascript confirmation appears, admin clicks ok and the form from this url should be submitted. I'm sooo new to javascript and frontend programming. I need your help.

Upvotes: 0

Views: 133

Answers (2)

Syed Salman Raza Zaidi
Syed Salman Raza Zaidi

Reputation: 2192

Try this

    var r=confirm("Press a button");
        if (r==true)
          {

//Form is on another page so
window.location="your_url_withquerystring"
          }
        else
          {

          }

Upvotes: 0

bipen
bipen

Reputation: 36531

use jquery submit()

$('#yourFormID').submit();

Upvotes: 1

Related Questions