update php var with js var from ajax call - javascript

I'm trying to update php $questNumber with the incremented javascript questNum with jQuery $.get()
Console.log tells me that the js questNum var is being incremented correctly.
But echo "testing..." . $questNumber; outputs 1 even after I've incremented the value on the JS side. This means the updated value is not being sent to $questNumber to update the database, and return the appropriate new set of values to the javascript side.
JavaScript:
/*Check player sentence input to see if grammar is correct*/
function submitMe() {
var input = document.getElementById('textBox').value;
log(questNum);
if ($.trim(input) == getSentence(questNum)) {
$("#responseVerify").html("Great job");
$("#textBox").val("").trigger("change");
//post successful quest to Quests.php, which will increment questcount there, and get new vocab words
questNum++;
log(questNum);
$.get("php/Quests.php", { "_questNum" : questNum},
function() {
$(".wordBank_Words").empty();
$.each(wordsArray, function(key, value) {
$(".wordBank_Words").append("<div class='bank-word' word='" + key + "' ><b>" + key + "</b>: " + value + "</div>");
});
});
}
else {
$("#responseVerify").html("Keep going...");
}
}
PHP:
<?php
//if user's input is correct, increment task number, get next vocabulary
include 'DbConnect.php';
$questNumber = (isset($_GET['_questNum']) ? ($_GET['_questNum']) : 1);
echo "testing..." . $questNumber;
$qry =
"SELECT t.*, v.*
FROM task t
INNER JOIN vocabtask vt ON (t.id = vt.taskid)
INNER JOIN vocab v ON (v.id = vt.vocabid)
WHERE vt.taskid = " . $questNumber;
$sql = $mysqli->query($qry);
$wordsArray = array();
while ($row = $sql->fetch_assoc()) {
echo $row['chinese'];
$wordsArray[$row['chinese']] = $row['english'];
}
echo "testing..." . $questNumber;
mysqli_close($mysqli);
echo "<script type='text/javascript'> var wordsArray = " . json_encode($wordsArray) . "; </script>";
?>
HTML:
<!--ROW 3: RESPONSE-->
<div class="row">
<div class="span12">
<!--Select a word shown and it gets added to the input box-->
Create sentence:
<input type="text" id="textBox" value="" />
<br/>
<button onclick="submitMe()" id="testButton" >Submit Response </button>
<br/>
<i><span id="responseVerify"></span></i><br />
<div class="wordBank_Headings">Word Bank:
<span class="wordBank_Words"></span>
</div>
<div class="wordBank_Headings">Hint:
<span class="wordBank_Hint"></span>
</div>
<div class="wordBank_Headings">New Words:
<span class="new"></span>
</div>
</div>
</div>

Try this ajax format
$.ajax({
type: "GET", //method
url:"php/Quests.php", //your ajax page
data:"_questNum="+questNum, //pass values to this data
success: function(data){ //success function
alert('sasas');
}

Related

How to pass the radio button value to other program and insert value into database using php and jquery

I have a form with multiple radio buttons. What i want to store the radio button values in database like 1 for "Yes" and 0 for "No". I am using couple of script a.php, b.php for the same, a.php will get the radio button values and pass to b.php as parameter. Then b.php insert into the database. The problem here is database field for button value always updating with 0. I tried to implement with javascript and some other php logic. But no luck. Also I have created other small script to test the radio value is printing properly which is working fine. The problem is I am not aware how to get proper value in "recommend" in b.php
I really appreciate your help.
a.php is like below:
<div id="result">
<label for="sel1">Would You recomend</label>
<div class="pull-left">
<input name='recommend' type='radio' value=1>Yes
<input name='recommend' type='radio' value=0>No
<button class="btn btn-primary btn-sm" id="submit" type="submit" value="submit">submit</button>
b.php
<?php
require_once './config.php';
$pid = intval($_POST["pid"]);
$uid = intval($_POST["uid"]);
$score = intval($_POST["score"]);
$recommend = intval($_POST["recommend"]);
$aResponse['error'] = FALSE;
$aResponse['message'] = '';
$aResponse['updated_rating'] = '';
$return_message = "";
$success = FALSE;
$sql = "INSERT INTO `tbl_product_rating` (`product_id`, `user_id`, `ratings_score`, `recommend_score`) VALUES "
. "( :pid, :uid, :score, :recommend)";
$stmt = $DB->prepare($sql);
try {
$stmt->bindValue(":pid", $pid);
$stmt->bindValue(":uid", $uid);
$stmt->bindValue(":score", $score);
$stmt->bindValue(":recommend", $recommend);
//$stmt->execute(':pid' => $pid, ':uid' => $uid, ':score' => $score, ':recommend' => $recommend));
$stmt->execute();
$result = $stmt->rowCount();
if ($result > 0) {
$aResponse['message'] = "Your rating has been added successfully";
} else {
$aResponse['error'] = TRUE;
$aResponse['message'] = "There was a problem updating your rating. Try again later";
}
} catch (Exception $ex) {
$aResponse['error'] = TRUE;
$aResponse['message'] = $ex->getMessage();
}
if ($aResponse['error'] === FALSE) {
// now fetch the latest ratings for the product.
$sql = "SELECT count(*) as count, AVG(ratings_score) as score FROM `tbl_products_ratings` WHERE 1 AND product_id = :pid";
try {
$stmt = $DB->prepare($sql);
$stmt->bindValue(":pid", $pid);
$stmt->execute();
$products = $stmt->fetchAll();
if ($products[0]["count"] > 0) {
// update ratings
$aResponse['updated_rating'] = "Average rating <strong>" . round($products[0]["score"], 2) . "</strong> based on <strong>" . $products[0]["count"] . "</strong> users";
} else {
$aResponse['updated_rating'] = '<strong>Ratings: </strong>No ratings for this product';
}
} catch (Exception $ex) {
#echo $ex->getMessage();
}
}
echo json_encode($aResponse);
?>
Jquery which I am using in a.php to send radio button value to b.php:
<script>
$document.ready(function(){
$('input[type="radio"]').click(function(){
var recommend = $(this).val();
$.ajax({
url:"b.php",
method:"POST",
data:{recommend:recommend},
// data:{recommend:$('#recommend').val($("[type='radio'] :checked").val())},
success: function(data){
$('#result').html(data);
}
});
});
});
</script>
jquery to fetch pid,uid,score..
<script>
$(document).on('click', '#submit', function() {
<?php
if (!isset($USER_ID)) {
?>
alert("You need to have a account to rate?");
return false;
<?php } else { ?>
var score = $("#score").val();
if (score.length > 0) {
$("#rating_zone").html('processing...');
$.post("update_ratings.php", {
pid: "<?php echo $_GET["pid"]; ?>",
uid: "<?php echo $USER_ID; ?>",
score: score
}, function(data) {
if (!data.error) {
// success message
$("#avg_ratings").html(data.updated_rating);
$("#rating_zone").html(data.message).show();
} else {
// failure message
$("#rating_zone").html(data.message).show();
}
}, 'json'
);
} else {
alert("select the ratings.");
}
<?php } ?>
});
</script>
I can insert the value 1 if "YES" for radio button with the mentioned jquery but it's inserting 0 for other fields like product_id..etc.I want just one entry to be inserted in db with proper value of radio button along with other fields.I have provided the full code for insert (b.php) with ajax which passing value to b.php from a.php. Kindly suggest.
I want output in mysql like below:
ratings_id product_id user_id ratings_score recommend_score
1 17637 1 4 0
2 17638 2 2 1
How it's happening now:
ratings_id product_id user_id ratings_score recommend_score
3 0 0 0 1
6 17639 2 4 0
In your ajax that fires once a user clicks on a radio-button you are not sending the other values needed for insert (pid, uid, score). I suppose they are included in the half-shown form.
Assuming you have those inputs in your form
<input name="pid" id="pid">
<input name="uid" id="uid">
<input name="score" id="score">
EDIT: since you've now shown more code I updated the code below (to match how you send pid & uid in the normal form-submit).
you can add them to the data object with something like this:
data:{
recommend:recommend,
pid: "<?php echo $_GET["pid"]; ?>",
uid: "<?php echo $USER_ID; ?>",
score: $('#score').val(),
},
Also change the double-ids of #newsletter as the others have suggested.
Change id to class attribute.
<script type="text/javascript">
$(document).ready(function() {
$("input[type=radio]").click(function () {
var recommend = $(this).val();
console.log(recommend);
$.ajax({
url:"b.php",
method:"POST",
data:{
recommend:recommend
},
success: function(data){
//your code here
},
error: function (error) {
console.log(error);
}
});
});
});
</script>
<input name="recommend" class='newsletter' type='radio' value=1>Yes
<input name="recommend" class='newsletter' type='radio' value=0>No
Sample HTML:
<input type="radio" name="color" id="rdoColor" value="green" />Green<br />
<input type="radio" name="color" id="rdoColor" value="Blue" />Blue<br />
Sample JQuery Code:
$(document).on("click", "input[id=rdoColor]", function(){
$.post(serverPath+"/colorHandler.php", {action: "saveColor", color: $(this).val()}, function(data){
var response = $.parseJSON(data);
// use this response as u need
});
});
Sample PHP (colorHandler.php):
$jsonStr = "";
define('DB_SERVER', 'DBserver:port');
define('DB_NAME', 'DBName');
define('DB_USER', 'dbUser');
define('DB_PASS', 'dbPass');
try {
$dbCon = new PDO("mysql:host=".DB_SERVER.";dbname=".DB_NAME, DB_USER, DB_PASS);
$dbCon->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "INSERT INTO colorTable (colorName) VALUES (?)";
$stmt= $dbCon->prepare($sql);
$stmt->execute(array($_POST["color"]));
if( $dbCon->lastInsertId() ){
$jsonStr = '{
"status":"Success",
"Message":"Color Saved"
}';
echo $jsonStr;
}else{
$jsonStr = '{
"status":"Failure",
"Message":"Color was not Saved"
}';
echo $jsonStr;
}
}catch(PDOException $e){
$jsonStr = '{
"status":"Failure",
"Message":"Database server not found!"
}';
echo $jsonStr;
}

How to pull variables from one PHP script to another

Having trouble pulling variables from one PHP to another script.
I have three different files, adminPage.html, reportScript.php, and report.php.
adminPage.html takes variables from the user and uses AJAX post function to post the variables to reportScript.php.
report.php is supposed to pull those posted variables from reportScript.php and use the variables in a SQL function, however, I am receiving an error stating that I have an "undefined index: startDate" and "undefined index: endDate" where I am instantiating the variables in PHP.
adminPage.html:
<center><h2> Choose the dates below that you need an order list from: </h2>
</br>
<form>
<h2>Start:</h2>
<input type="date" id ="reportStartDate" name = "startDate">
</br>
<h2>End:</h2>
<input type="date" id ="reportEndDate" name = "endDate">
</form>
</center>
</br></br>
<button id="runReportButton" onclick = "runReport()"> Run Report </button>
<script>
function runReport()
{
var jStartDate;
var jEndDate;
jStartDate = document.getElementById("reportStartDate").value;
jEndDate = document.getElementById("reportEndDate").value;
/*console.log(jStartDate);
console.log(jEndDate); */
$.ajax
({
type: "POST",
url: "phpScripts/reportScript.php",
data: {startDate: jStartDate, endDate: jEndDate},
success: function(response)
{
console.log("posted");
window.open("report.php", "_self");
}
});
}
</script>
reportScript.php:
<?php
require 'connect.php';
//posts data to db
$startDate = $_POST["startDate"];
$endDate = $_POST["endDate"];
$sql = "SELECT * FROM orderlist WHERE NOT (dateOrdered < startDate OR
dateOrdered > endDate)";
$result = $conn->query($sql);
if($result){
echo "true";
}
else{
echo "false";
}
?>
report.php:
<?php
require 'phpScripts/connect.php';
require 'phpScripts/reportScript.php';
//posts data to db
/*$startDate = $_POST['startDate'];
$endDate = $_POST['endDate'];*/
/*$startDate = '2018-01-01';
$endDate = '2018-08-08'; */
$sql = "SELECT * FROM orderlist WHERE NOT (dateOrdered < '$startDate' OR dateOrdered > '$endDate');";
$result = $conn->query($sql);
//above is reportScript.php, below is pulling list method from order.php
//below works, just needs variables from the reportScript
echo "<ul>";
if($result->num_rows >0)
{
$i = 0;
while($row = $result->fetch_assoc()) // this loads database into list, also
creates array of pricing which someone can pull from later to get total
{
echo "<li style='font-size:15px'>".$row["drinkName"]. ", Date Ordered: "
.$row["dateOrdered"] . ",Cost: " .$row["drinkCost"] . "</li>";
echo "</br>";
$i = $i+1;
}
}else {
echo "<p> you're a dummy and you did this wrong </p>";
}
echo "</ol>";
?>
You forgot the dollar sign ($) in your variables in reportScript.php.
$sql = "SELECT * FROM orderlist WHERE NOT (dateOrdered < $startDate OR
dateOrdered > $endDate)";
This statement is also vulnerable to sql injection.
With some of the advice taken from #Ralf, I combined both reportScript.php and report.php, and used a $_GET statement to put the date variables into the URL upon opening. This way, the query isn't placed twice and the variables are still saved.

PHP Variable inside PHP -> Echo -> Javascript

so I have issue I don't even know how to tell it. But here it is.
//Coupon Code?
if($row['coupon'] == null or $row['2email'] == 'Confirmed')
{
echo '<td>
<input type="text" onKeyup="trackChange(this.value)" id="myInput">
<script type="text/javascript">
var dID = <?php echo $dID; ?>;
function wait(ms){
var start = new Date().getTime();
var end = start;
while(end < start + ms) {
end = new Date().getTime();
}
}
function trackChange(value)
{
window.open("/functions.php?cCODE="+value+"&ccID="+dID)
}
</script>
</td>';
All I need is to get "user ID" from $dID=$row['ID']; but as it seems It just echo out that to the result and don't do any job. How can I get php variable inside php -> inside Echo -> inside Javascript.
I thought by going other way but I need text box and then submit to url. But I can't seem to get it working. Only 1 request at a time and I need 2. (User ID, and text to text box response)
echo " <td><form action= functions.php?cID= method= 'post'><input
type='hidden' name='cID' value=$dID />
<input type= 'submit' name= 'type' value= Confirm></form></td>";
So I can't get them both to submit that. Only found a way inside javascript.
Picture of text field
You'll want to use string concatenation (using the . character) to insert a variable into your string. Like this:
echo '
[...]
<script type="text/javascript">
var dID = ' . $dID . ';
function wait(ms){
[...]
';
A . will concatenate two strings together. For example:
echo 'hello ' . ' world'
You can also insert a variable directly into a string, if you use double quotes. Single quotes do not allow you to do this:
$text = "world";
echo "hello $text";
In general, you should wrap your variables in curly brackets ({ and })
$text = "world";
echo "hello {$text}";
You can just concatenate the variable there
To concatenate use .
if($row['coupon'] == null or $row['2email'] == 'Confirmed')
{
echo "<td>
<input type='text' onKeyup='trackChange(this.value)' id='myInput'>
<script type='text/javascript'>
var dID = '".$dID."'
function wait(ms){
var start = new Date().getTime();
var end = start;
while(end < start + ms) {
end = new Date().getTime();
}
}
function trackChange(value)
{
window.open('/functions.php?cCODE='+value+'&ccID='+dID)
}
</script>
</td>";

How to get AJAX to show a success function and allow the page to update database results

I have the following code that I cannot figure out how to allow my AJAX call to send to my PHP file and then allow my page to show the changes on the page without submitting the form. The reason I need the page to not reload is to allow the success message to display.
What I am trying to do is approve a user and once they have been approved their name will show up in a different section of the page and then I want the success message to display after the changes have been made.
As of now everything works in my database and the status changes. Also the success message shows up where it is supposed to, but the user's name does not move until I reload the page.
How can I get all of this to work without reloading the page?
if( $numrows ) {
while($row = mysqli_fetch_assoc($run)){
if($row['status'] == "Pending"){
$pending_id = $row['id'];
$pending_user_id = $row['user_id'];
$pending_firstname = $row['firstname'];
$pending_lastname = $row['lastname'];
$pending_username = $row['username'];
$pending_email = $row['email'];
?>
<form action="" method="POST" id="status">
<input type='hidden' name='id' value='<?php echo $pending_id; ?>' id='pending_id'/>
<?php
if ($pending_firstname == true) {
echo "Name - ". $pending_firstname . " " . $pending_lastname . "</br>" .
"Username - ". $pending_username . "</br></br>"
?>
<button class="approve" type="submit" form="status" name="approve" value="<?=$pending_id;?>">Approve</button>
<button class="deny" type="submit" form="status" name="deny" value="<?=$pending_id;?>">Deny</button>
</form>
AJAX
$('.approve').click(function () {
$.ajax({
url: 'userRequest_approve.php',
type: 'POST',
data: {
id: $(this).val(), //id
status: 'Approved' //status
},
success: function (data) {
//do something with the data that got returned
$("#success").fadeIn();
$("#success").show();
$('#success').html('User Status Changed!');
$('#success').delay(5000).fadeOut(400);
},
//type: 'POST'
});
return false;
});
UPDATE TO SHOW OUTPUTTED DATA
<h2>Approved User Requests</h2><br>
<div id="success" style="color: red;"></div><br>
$run2 = mysqli_query($con2,"SELECT * FROM user_requests ORDER BY id DESC");
$runUsers2 = mysqli_query($con2,"SELECT * FROM users ORDER BY id DESC");
$numrows2 = mysqli_num_rows($run2);
if( $numrows2 ) {
while($row2 = mysqli_fetch_assoc($run2)){
if($row2['status'] == "Approved"){
//var_dump ($row2);
$approved_id = $row2['user_id'];
$approved_firstname = $row2['firstname'];
$approved_lastname = $row2['lastname'];
$approved_username = $row2['username'];
$approved_email = $row2['email'];
if ($approved_firstname == true) {
echo "Name - ". $approved_firstname . " " . $approved_lastname . "</br>" .
"Username - ". $approved_username . "</br></br>"
Is it the same page you call from your ajax query and for the message success ?
You should use json in your php file, then you can check for any values you add in the callback like this:
userRequest_approve.php
<?php
header('Content-type: application/json');
echo '[{"success":1,"username","theusername"}]';
?>
script.js
$('.approve').click(function(){
$.post('userRequest_approve.php',$('#status').serialize(),function(data){
alert(data[0].success+' username='+data[0].username);
},'json');
return false;
});

For each ajax request,PHP return different results based on the time row was created

I have an ajax loop that returns recently created profiles from PHP encoded for JSON.
What i want to do is first return the most recently created profile and go to the second recently created profile and so on every time ajax sends a request to PHP.
How do i do this. So far the ajax loop just returns the same result since i can only get one recently created profile.
Here's my PHP:
<?php
require_once 'db_conx.php';
$Result = mysql_query("SELECT * FROM profiles ORDER BY lastupdated desc limit 1")
or die (mysql_error());
while($row = mysql_fetch_array($Result)){
$result = array();
$result['logo'] = $row['logo'];
$result['name'] = $row['name'];
echo json_encode($result);
}
?>
In the above php Block, if i remove 'limit 1' to something else, the ajax just stops working altogether.
Here's my ajax code:
get_fb();
var get_fb = (function(){
var counter = 0;
var $buzfeed = $('#BuzFeed');
return function(){
$.ajax({
dataType : 'json',
type: "GET",
url: "../php/TopBusinesses_Algorythm.php"
}).done(function(feedback) {
counter += 1;
var $buzfeedresults =
$("<div style='margin-bottom:2px'><input name='1' type='submit' id='LogLogo' value=' '><span id='name' style='float:right; height:21px;font-weight:bold; color:#000; width:71%' class='goog-flat-menu-button'><span class='LogName'></span></span><span id='slogan'><span class='LogSlogan'></span></span><span id='services'><span class='LogServices'></span></span></div></div><span id='LogPid' style='height:170px; background-image:url(images/bg/iWhiteBg.fw.png)'></span></div>");
$('.LogName').html(feedback.name).attr('id' + counter);
$( '.LogSlogan' ).html(feedback.slogan);
$('.LogPId').html(feedback.pid);
$('.LogLogo').css('background-image', 'url(' + feedback.logo + ')' ).css('background-size', 'cover')
$buzfeedresults.append(feedback);
$buzfeed.append($buzfeedresults);
var $buzfeedDivs = $buzfeed.children('div');
if ($buzfeedDivs.length > 7) { $buzfeedDivs.last().remove(); }
setTimeout(get_fb, 2000);
})
});
};
})();
get_fb();
The problem is you output several JSON strings on the page try something like this:
<?php
require_once 'db_conx.php';
$Result = mysql_query("SELECT * FROM profiles ORDER BY lastupdated desc limit 10") or die (mysql_error());
$results = array();
while($row = mysql_fetch_array($Result)){
$result['logo'] = $row['logo'];
$result['name'] = $row['name'];
$results[]=$result;
}
echo json_encode($results);
you can do it in following ways:
declare counter variable globally(outside of get_fb() function) so that it will hold actual ajax call count
pass this counter value to ajax request
receive this counter value at your php end and use it as offset value to your sql(ex. limit offset,1)
======
edit
var counter = 0;
var get_fb = (function(){
var $buzfeed = $('#BuzFeed');
return function(){
$.ajax({
dataType : 'json',
type: "GET",
url: "../php/TopBusinesses_Algorythm.php?counter="+counter
}).done(function(feedback) {
counter += 1;
var $buzfeedresults =
$("<div style='margin-bottom:2px'><input name='1' type='submit' id='LogLogo' value=' '><span id='name' style='float:right; height:21px;font-weight:bold; color:#000; width:71%' class='goog-flat-menu-button'><span class='LogName'></span></span><span id='slogan'><span class='LogSlogan'></span></span><span id='services'><span class='LogServices'></span></span></div></div><span id='LogPid' style='height:170px; background-image:url(images/bg/iWhiteBg.fw.png)'></span></div>");
$('.LogName').html(feedback.name).attr('id' + counter);
$( '.LogSlogan' ).html(feedback.slogan);
$('.LogPId').html(feedback.pid);
$('.LogLogo').css('background-image', 'url(' + feedback.logo + ')' ).css('background-size', 'cover')
$buzfeedresults.append(feedback);
$buzfeed.append($buzfeedresults);
var $buzfeedDivs = $buzfeed.children('div');
if ($buzfeedDivs.length > 7) { $buzfeedDivs.last().remove(); }
setTimeout(get_fb, 2000);
})
});
};
})();
get_fb();
<?php
require_once 'db_conx.php';
$counter = $_REQUEST['counter'];
if(!$counter)$counter=0;
$Result = mysql_query("SELECT * FROM profiles ORDER BY lastupdated desc limit $counter,1")
or die (mysql_error());
while($row = mysql_fetch_array($Result)){
$result = array();
$result['logo'] = $row['logo'];
$result['name'] = $row['name'];
echo json_encode($result);
}
?>
=========
edit
var $buzfeedresults =
$("<div style='margin-bottom:2px'><input name='1' type='submit' id='LogLogo"+counter+"' value=' '><span id='name' style='float:right; height:21px;font-weight:bold; color:#000; width:71%' class='goog-flat-menu-button'><span class='LogName' id='log_name"+counter+"'></span></span><span id='slogan'><span class='LogSlogan' id='log_slogan"+counter+"'></span></span><span id='services'><span class='LogServices'></span></span></div></div><span id='LogPid"+counter+"' style='height:170px; background-image:url(images/bg/iWhiteBg.fw.png)'></span></div>");
$('#log_name'+counter).html(feedback.name);
$( '#log_slogan'+counter ).html(feedback.slogan);
$('#LogPId'+counter).html(feedback.pid);
$('#LogLogo'+counter).css('background-image', 'url(' + feedback.logo + ')' ).css('background-size', 'cover')
So i revised the structure of this Feed System and found out an easier way to do this is to generate the html from php.
So here's the PHP with HTML
<?php
require_once 'db_conx.php';
$Result = mysql_query("SELECT * FROM profiles ORDER BY lastupdated desc limit 10")
or die (mysql_error());
while($row = mysql_fetch_array($Result)){
echo '<div style="margin-bottom:2px">
<span id="name" style="float:right; height:21px;font-weight:bold; color:#000; width:71%">
<span class="LogName">'.$row['name'].'</span>
</span>
<span id="slogan" style="float:right; height:21px;color:#0D1; width:71%" class="goog-flat-menu-button">
<span class="LogSlogan">'.$row['slogan'].'</span>
</span>
<span id="services" style="float:right; height:21px;color:#000; width:71%" class="goog-flat-menu-button">
<span class="LogServices">'.$row['services'].'</span>
</span>
</div>
</div>
<span id="ProfileMap" style="height:170px; background-image:url(images/bg/iWhiteBg.fw.png)"></span>
<span id="LogPid" style="height:170px; background-image:url(images/bg/iWhiteBg.fw.png)"></span>
</div>';
}
?>
Ajax.
$.ajax({
type:"GET",
url:"../php/feed.php"
}).done(function(feedback){
$('#feed').html(feedback)
});
and just one Div of HTML in the body to house the incoming HTML.
<body>
<div id='feed'></body>
</body>
Done.

Categories