Please can some one help me with whis case. I want to get value from variable arg with php to process the data. This is my script
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Demo</title>
</head>
<body>
<h3>Simple initalization with default settings</h3>
<hr>
<canvas></canvas>
<hr>
<ul></ul>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/qrcodelib.js"></script>
<script type="text/javascript" src="js/webcodecamjquery.js"></script>
<script type="text/javascript">
var arg = {
resultFunction: function(result) {
$('body').append(result.code);
}
};
$("canvas").WebCodeCamJQuery(arg).data().plugin_WebCodeCamJQuery.play();
</script>
</body>
</html>
The value i want is in (result.code). What php code that can make it happen. Thanks
You can hold the result in a variable and pass it to PHP through Ajax request like this
<script type="text/javascript">
var result_data=[];
var arg = {
resultFunction: function(result) {
$('body').append(result.code);
result_data=JSON.parse(result);
}
};
$("canvas").WebCodeCamJQuery(arg).data().plugin_WebCodeCamJQuery.play();
$.ajax({
type: "POST",
url: "someaction.php",
data: {data:result_data.code},
success: function(resultData)
{
}
</script>
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.