Klajdi Dosti Klajdi Dosti - 7 months ago 28
Javascript Question

how to execute first php function than javascript function onclicking a submit button

i have this input:

<input type="submit" name="rregjistro" value="Rregjistro" onclick="open()" >

I want first to execute POST script in PHP and than to open a modal popup using a javascript function.
How can i do it?
Can you please help me!
Thanks in advance!


It is not possible to click using PHP because form submission is the action on the client's side, i.e in your browser. Events in the browser like this can be executed by javascript or other client language.

<form ... >
<input type="submit"  name="rregjistro" value="Rregjistro" />
<!-- remove onclick attribute for now -->


<div id="myResult"></div>

        // url needs to belong to your domain
        $.ajax({url: "/your_url_path", success: function(result){