我正在尝试为页面中的所有个人创建自定义链接。每个人都有一个单独的身份证。如何使用GET
参数创建链接。使用JSON
的Javascript
$.getInfo = function() {
var selected_reference_id = $.cookie("selected_reference_id");
$.ajax({
url: "assets/functions/editor.php",
type: "post",
data: {selected_reference_id: selected_reference_id},
success: function(data) {
var json_data = JSON.parse(data);
console.log(json_data);
console.log(json_data[0].profile_image_url);
$("#editor_name").html(json_data[0].name);
$("#profile_description").html(json_data[0].profile_description);
$("#profile_picture").html('<img alt="" id="profile_picture" src="' + json_data[0].profile_image_url + '" class="member-img">');
$("#main_video").html('<video id="MY_VIDEO_0" class="video-js vjs-default-skin" controls \n\
preload="none" width="640" height="264" poster="' + json_data[0].thumbnail_url + '"\n\
data-setup="{}">\n\
<source src="' + json_data[0].video_url + '" type="video/mp4">\n\
<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>\n\
</video>');
$("#editor_tags").append(json_data[0].is_sports);
$("#editor_tags").append(json_data[0].is_weddings);
$("#editor_tags").append(json_data[0].is_travel);
$("#editor_tags").append(json_data[0].is_everyday_moments);
$("#editor_tags").append(json_data[0].is_special_occasions);
$("#editor_tags").append(json_data[0].is_motion_graphics);
$("#editor_tags").append(json_data[0].is_promo);
$("#editor_tags").append(json_data[0].is_tutorials);
$("#editor_tags").append(json_data[0].is_crowdfunding);
$("#editor_tags").append(json_data[0].is_collage);
$.each(json_data, function(index) {
//console.log(data[index].email);
var addRow = '<li class="mix all" style="margin-bottom: 6px;"><video id="MY_VIDEO_' + index + '" class="video-js vjs-default-skin" controls \n\
preload="none" width="100%" height="264" poster="' + json_data[index].thumbnail_url + '"\n\
data-setup="{}">\n\
<source src="' + json_data[index].video_url + '" type="video/mp4">\n\
<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>\n\
</video></li>';
// var addRow = '<li class="mix webdesign">\n\
// <!-- <img src="themes/demo/assets/dream/images/work/thumbnail-01.jpg" alt=""/> -->\n\
// <video style="width: 100%; height: 100%" controls>\n\
// <source src="' + json_data[index].video_url + '" type="video/mp4">\n\
// <source src="' + json_data[index].video_url + '" type="video/ogg">\n\
// </video>\n\
// </li>';
if (index !== 0) {
$("#work-preview").append(addRow);
}
});
// $("#main_video").html('<video style="width: 40%; height: 40%" class="video" controls>\n\
// <source src="'+json_data[0].video_url+'" type="video/mp4">\n\
// <source src="'+json_data[0].video_url+'" type="video/ogg">\n\
// </video>');
// if (json_reserve.alreadyReserved === 0) {
// $("#upload_row").show();
// $.timer(json_question[0].timeleft);
// } else {
// $.dialogAlreadyReserved(); //a function I defined to pop up a dialog
// $.throbberHide();
// }
}
});
};
$.getInfo();
PHP
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
include_once($root . '/assets/functions/db_dream.php');
$response = array();
$selected_reference_id = $_REQUEST['selected_reference_id'];
$DB = new DB();
$db = $DB->connect();
$stmt1 = $db->prepare("SELECT * FROM editors LEFT JOIN profile_videos pv ON editor_email = email WHERE reference_id = :reference_id ORDER BY pv.priority");
$stmt1->bindValue(':reference_id', $selected_reference_id, PDO::PARAM_INT);
$stmt1->execute();
$results = $stmt1->fetchAll(PDO::FETCH_ASSOC);
foreach ($results as $row) {
$details = array();
$details["reference_id"] = $row['reference_id'];
$details["email"] = $row['email'];
$details["name"] = $row['name'];
$details["profile_description"] = $row['profile_description'];
$details["profile_image_url"] = $row['profile_image_url'];
$details["video_url"] = $row['video_url'];
$details["thumbnail_url"] = $row['thumbnail_url'];
$details["editor_email"] = $row['editor_email'];
$details["priority"] = $row['priority'];
if($row['is_sports']){
$details["is_sports"] = "<a class='button_custom small' style='margin-right: 5px' >EXTREME SPORTS</a>";
}else{
$details["is_sports"] = "";
}
if($row['is_weddings']){
$details["is_weddings"] = "<a class='button_custom small' style='margin-right: 5px'>WEDDINGS</a>";
}else{
$details["is_weddings"] = "";
}
if($row['is_travel']){
$details["is_travel"] = "<a class='button_custom small' style='margin-right: 5px'>TRAVEL</a>";
}else{
$details["is_travel"] = "";
}
if($row['is_everyday_moments']){
$details["is_everyday_moments"] = "<a class='button_custom small' style='margin-right: 5px'>EVERYDAY MOMENTS</a>";
}else{
$details["is_everyday_moments"] = "";
}
if($row['is_special_occasions']){
$details["is_special_occasions"] = "<a class='button_custom small' style='margin-right: 5px'>SPECIAL OCCASIONS</a>";
}else{
$details["is_special_occasions"] = "";
}
if($row['is_motion_graphics']){
$details["is_motion_graphics"] = "<a class='button_custom small' style='margin-right: 5px'>MOTION GRAPHICS</a>";
}else{
$details["is_motion_graphics"] = "";
}
if($row['is_promo']){
$details["is_promo"] = "<a class='button_custom small' style='margin-right: 5px'>PROMOS</a>";
}else{
$details["is_promo"] = "";
}
if($row['is_tutorials']){
$details["is_tutorials"] = "<a class='button_custom small' style='margin-right: 5px'>TUTORIALS</a>";
}else{
$details["is_tutorials"] = "";
}
if($row['is_crowdfunding']){
$details["is_crowdfunding"] = "<a class='button_custom small' style='margin-right: 5px'>CROWDFUNDING</a>";
}else{
$details["is_crowdfunding"] = "";
}
if($row['is_collage']){
$details["is_collage"] = "<a class='button_custom small' style='margin-right: 5px'>PHOTO COLLAGE</a>";
}else{
$details["is_collage"] = "";
}
array_push($response, $details);
}
echo json_encode($response);