[英]Grab Jquery Selector value into php
I have a variable in jquery selector and i want to grab it using php. 我在jquery选择器中有一个变量,我想使用php来抓取它。
Say $('#rowidtext').val(id);
说
$('#rowidtext').val(id);
and can pass to <input type="text" name="rowidtex" id="rowidtext" >
but i want to receive in something like $value=??
并可以传递给
<input type="text" name="rowidtex" id="rowidtext" >
但是我想接收类似$value=??
东西$value=??
How can it be achieved? 如何实现?
The code in js are: function viewrow(id){ $('#rowidtext').val(id); js中的代码是:function viewrow(id){$('#rowidtext')。val(id);
$( "#viewrecordsdialog" ).dialog( "open" ); $(“ #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 创建另一个名为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;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.