I have a variable in jquery selector and i want to grab it using php.
Say $('#rowidtext').val(id);
and can pass to <input type="text" name="rowidtex" id="rowidtext" >
but i want to receive in something like $value=??
How can it be achieved?
The code in js are: function viewrow(id){ $('#rowidtext').val(id);
$( "#viewrecordsdialog" ).dialog( "open" ); }
$(document).ready(function() {
$( "#viewrecordsdialog" ).dialog({
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide();
},
autoOpen: false,
width: 500,
modal: true,
closeOnEscape: false,
buttons: [
{
text: "Close",
click: function() {
$( this ).dialog( "close" );
}
}
]
});
});
您可以将其放在隐藏的表单中,该表单将在重新加载页面时提交,然后通过PHP获取结果。
Create another named anyDivName
$(document).ready(function() {
function ajaxLoaded(response) {
$('#anyDivName').empty().html(response);
}
function doRequest() {
var rowId= $('#rowidtext').val();
$('#anyDivName').empty().html('loading');
$.ajax({
url : "results.php",
type : 'POST',
success : ajaxLoaded,
data : {
val : rowId
}
});
}
});
Then get that variable with:
if (isset ( $_POST ['val'] )) {
$intCase = intval ( $_POST ['val'] );
} else {
return;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.