You are not logged in.
Pages: 1
Yh it is being.but the actual problem was with the permissions on the file. I had created it in an IDE(Netbeans) and it seems it was given some restrictions. When i recreated it in a text editor...it worked just fine. Thank You.
Hi, So i'm currently working on a website that loads a container once a button is clicked and the content is loaded via an AJAX function. The problem is at the PHP side, I cannot access the variable i pass through the AJAX function through my REQUEST array. I'm not sure if it is a problem with big tree.But i really would appreciate some help.
This is the button i use to call the function:
<div class="button-holder">
<button class="project-btn" data-id='<?=$id?>' onclick="getProject(<?=$id?>)">
<h3 class="btn-text">View Project</h3>
<h3 class="hide-reveal">→</h3>
<h3 class="button-pike"></h3>
</button>
So this is my ajax function:
function getProject(id)
{
var ajaxUrl='ajax/singleProject?id=' + id;
$.ajax(ajaxUrl, {
async: true, complete: getProjectComplete
});
}
function getProjectComplete(xhr, status) {
if (status == false)
{
return;
}
var obj = $.parseJSON(xhr.responseText);
$('.pro-heading').html(obj.company);
$('.pro-subtext').html(obj.project_heading + '(' + obj.start_date + ')');
$('.pro-image').attr('src', obj.project_image);
$('.pro-brief').html(obj.project_brief);
$('.pro-details').html(obj.project_details);
console.log(obj);
}
and this is my PHP function:
<?php
if (isset($_REQUEST['id']))
$id = $_REQUEST['id'];
$obj = new Projects();
$single = $obj->get($id);
echo json_encode($single);
?>
Pages: 1