I just stuck on some problem with my code. Could anybody please tell me what i have done wrong?
html:
<button type="button" id="searchbutton">Click Me!</button>
<div id="resultsdiv"></div>
js:
$(document).ready(function() {
$("#searchbutton").bind('click', function() {
$("#resultsdiv").load(
'http://profithing.com/wp-content/php/sorting.php',
{ // parameters, in object literal format
sortDir: 'asc',
sortCol: 'name'
// etc.
}
});
});
php:
<?php
mysql_connect("localhost", "login", "pass") or die(mysql_error());
mysql_select_db("database");
$result = mysql_query("SELECT * FROM table ORDER BY added ASC");
while($row = mysql_fetch_array($result))
{
echo "<div class='something'>";
echo "<a href='$row[link]'>";
echo "<img src='$row[img]' height='125' width='125'/>";
echo "<p>$row[name]</p></a></div>";
echo "<br>";
}
?>
jsFiddle is here
i think that my php is ok, there must be some problem in calling it.
Thanks for help.
EDIT: added php code