The easiest way would be to use a hidden input field and use jQuery to set the value for this input field or these input fields in your case.
HTML:
<form action="inc/genxml.php" method="post">
<input id="nameTxt" name="name"type="text" value="test"/>
<input id="posLeft" name="posLeft"type="hidden" />
<input id="posRight" name="posRight"type="hidden" />
<button id="nameSave" class="left">Save</button>
</form>
JS:
$('#nameSave').click(
function() {
var pos = $('#name').position();
$('#posLeft').val(pos.left);
$('#posRight').val(pos.right);
}
);
Try this:
var pos = $('#name').position();
$("form").append('<input type="hidden" name="name_position" value="' + pos.left + ',' + pos.top + '" />');
Then read name_position
value from the POST data in the server side code.
Post a Comment for "How To Assign The Value Of A Javascript Variable To A Php Variable"