Hi, I downloaded this comment wall script here Facebook Wall Script 3.0 with PHP and Jquery
And I’m attempting to customise and expand it and I’ve not done so bad so far. Guy knows what he is doing but I’ve managed to condense a lot of functions and better organise some stuff for better results.
But I cannot figure out the javascript side. I want to require a poster to put in their name and email before submitting a comment. I struggled to figure out why the variables weren’t passing and then realised that they were processed through a javascript file for AJAX. But I cannot understand it well enough to figure out how to pass the additional variables.
This is the code.
$(document).ready(function()
{
// Update Status
$(".update_button").click(function()
{
var updateval = $("#update").val();
var dataString = 'update='+ updateval;
if(updateval=='')
{
alert("Please Enter Some Text");
}
else
{
$("#flash").show();
$("#flash").fadeIn(400).html('Loading Update...');
$.ajax({
type: "POST",
url: "message_ajax.php",
data: dataString,
cache: false,
success: function(html)
{
$("#flash").fadeOut('slow');
$("#content").prepend(html);
$("#update").val('');
$("#update").focus();
$("#stexpand").oembed(updateval);
}
});
}
return false;
});
There’s further code in the file but this is the part pertinent to what I need. updateval, as far as I can tell is taking the information from “update” here.
<form method="post" action="">
<input type='text' name='nickname' id='nickname' maxlength='25' />
<label for='fullname'>Your Name: <em>(required)</em> </label>
<br />
<input type='email' name='email' id='email' maxlength='30'/>
<label for='email'>Email (will not be published) <em>(required)</em> </label>
<br />
<input type='text' name='website' id='website' maxlength='50'/>
<label for='website'>Website </label>
<br />
<textarea cols="30" rows="4" name="update" id="update" maxlength="400" ></textarea>
<br />
<input type="submit" value=" Submit Comment " id="update_button" class="update_button"/>
</form>
Does anyone know how to do this? I’m sure it will be something simple but I just don’t know any javascript or AJAX, all I ended up doing was combining username and message into one field.
If it helps, this is what I’ve done. http://cms.mediaxombie.com/wall/