Is it possible to send data from a webpage but only certain parts of it? For example:
Webpage from form:
<html>
<head>
</head>
<body>
<div>Non-form data</div>
<form method="post" action="">
<input type="text" id="field1" />
</form>
<div>Other non-form data</div>
<?php
$field = mysql_real_escape_string($_POST["field1"]);
// Database info
echo $field . "is in the database or whatever...";
?>
</body>
</html>
I want to check the value of field1 against a database in PHP. When I do $.post($(this).attr("action"), { field: $(#field1).val() }, function(data) { alert(data); }); it returns the entire coding from the webpage instead of just the echo part of the php, which is what I want only. Is there a fix for this or do I have to actually create another file with the php coding and send it to that? Thanks for any help I can get.