Hi
New to this forum.
I have the following situation:
I have a form (inside a larger page) that passes a value through ajax to a php file that uses this value in session.
I use ajax because I don’t want to page to change. I would like the java-script to refresh the page after it sends the data to to the sessions.php.
the following code requires me to click twice on the submit button (once to send the value and second to refresh)
the form:
<form action=”” method=”post” id=”send_id”>
<input type=”text” id=”state” name=”state” />
<input type=”hidden” id=”abbrev” name=”id_num” />
<input type=”hidden” id=”state_id” name=”state_id” /> <br>
<input type=”submit” name=”submitBtn”value=”עבור לכרטיסיית מועמד/ת” class=”small button” />
</form>
the js
<script language=”javascript” type=”text/javascript”>
$(function() {
$(‘#send_id’).on(‘submit’, function(e) {
var data = $(“#send_id :input”).serialize();
$.ajax({
type: “POST”,
url: “sessions.php”,
data: data,
});
});
});
</script>
Thanks in advance