I have this code which posts data to a page and returns data. This is done through javascript. I want to post to different pieces of data from the form, the url which is already there and a hidden user field. Here is the code;
function go(url) {
$.post('urlin.php', { url : url }, function(data ) {
if (data== 'error_no_url'){
$('#message').html('<p>Try entering an actual URL!</p>');
} else if (data == 'error_roll') {
window.open('http://1227.com');
$('#message').html('<p>ROFL</p>');
} else if (data == 'error_invalid_url') {
$('#message').html('<p>Not a valid URL</p>');
} else if (data == 'error_is_min') {
$('#message').html('<p>Already a short URL, it can\'t get any shorter!</p>');
} else {
$('#url').val(data);
$('#url').select();
$('#message').html('<p> URL Shortened </p>');
}
});
}
and;
<p><input type="text" size="85" placeholder="Enter a URL to shorten." name="url" id="url" onkeydown="if (event.keyCode == 13 || event.which == 13) { go($('#url').val()); }" /><input type="hidden" name="user" value="<?php echo $_SESSION['auth']; ?>"><input type="submit" class="btn green" value="Shorten" border="0" onclick="go($('#url').val());" />
At the moment it only posts the url. How can i get it to post the user aswell.