Hi guys, I am trying to get some data back from a server using jQuery $.getJSON
, and the code seems to work fine, until it gets to $.getJSON
, it doesn't seem to be triggering that at all, there are no console logs when I press the button, here is the code below,
$(document).ready(function(){
var funk;
$('#button').live('click', function(){
var funk = "";
var query = "";
$('#wrapper > [data-custom="field"]').each(function(i, data){
if(i == 0){
funk = query + $(this).attr('id')+" = '"+$(this).val()+"'";
}else{
funk = funk + " AND " + $(this).attr('id')+" = '"+$(this).val()+"'";
};
});
$.getJSON('test.php', {query: funk}, function(json){
console.log(json)
});
});
});
the PHP file test.php in the same folder,
$weo = $_GET['query'];
echo $weo;
Any ideas on what could be causing the problem?
Thanx in advance!