如何检索AJAX中选择器的值并保存在PHP中?
How to retrieve the value of the selector in AJAX and save it in PHP?
我有 prop() 方法,想在 php 中检索 "show_pdf1" 并将值保存在那里以在返回 readPdf.php 的最终结果之前进行处理。
如何在不使用其他方法的情况下使用 属性 方法来执行此操作?
$('#show_pdf1').prop('src', 'php/readPdf.php');
在php我想保存为
$value = 'show_pdf1'; //retrieve the selector here
$.post('php/readPdf.php', {whichFrame:whichFrame,value:value},
function(data) {
$('#'+whichFrame+'').prop('src', data);
});
whichFrame 和 value 是 javascript 方法,您可以通过 id 从不同的标签中获取值。
我的readPdf.phpreturn文件。
<?php
echo $file1; //this get set as data as a 'src' attribute.
?>
就是这样,还是谢谢了!
我有 prop() 方法,想在 php 中检索 "show_pdf1" 并将值保存在那里以在返回 readPdf.php 的最终结果之前进行处理。 如何在不使用其他方法的情况下使用 属性 方法来执行此操作?
$('#show_pdf1').prop('src', 'php/readPdf.php');
在php我想保存为
$value = 'show_pdf1'; //retrieve the selector here
$.post('php/readPdf.php', {whichFrame:whichFrame,value:value},
function(data) {
$('#'+whichFrame+'').prop('src', data);
});
whichFrame 和 value 是 javascript 方法,您可以通过 id 从不同的标签中获取值。
我的readPdf.phpreturn文件。
<?php
echo $file1; //this get set as data as a 'src' attribute.
?>
就是这样,还是谢谢了!