Galexrt Galexrt - 4 months ago 76
Javascript Question

Send post data to iframe and reload the iframe

I tried something something like this using jquery, but i failed.

$.ajax({
type: "POST",
url: "myphphere.php",
data: {
command: $('#command').var()
}
});


I also thought about refreshing the page using the onclick attribute of a button to submit the form.

Answer

why just use an target attribute in form?

<form action="..." target="an_iframe" type="post">
<input type="text" name="cmd" placeholder="type a command here..." />
<input type="submit" value="Run!" />
</form>
<iframe id="an_iframe"></iframe>

Hope it solved your problem.

Comments