I have the below JQuery. Nothing happens and I have no idea how to debug this othr than using Firebug which is showing no errors. How do I know where it is failing and if its even activating the script in the file? This is being used in an iframe for a facebook app, could this this be an issue? Any help much appreciated.
$(document).ready(function(){
$('#shopkeeperID').submit(function(){
var skID = $("#skID").val();
showLoading();
sendValue(skID);
});
});
function sendValue(str){
$.ajax({
type: "GET",
url: "/var/www/web/shopkeeper/index.php",
data: shopkeeper=+str,
success: function(response) {
$('#response').html(response);
hideLoading();
//refresh page
}
});
}
//show and hide loading icon
function showLoading() {
$("#loading").show();
}
function hideLoading() {
$("#loading").hide();
}
I strongly recommend using the console in Firebug. Among many other things, it’s great for debugging jscripts. Shows you what kind of data is being passed and received and is good at identifying errors.
The problem seems to be what you’re passing in data. You need a key=>value pair and it seems like you’re only passing a value. E.g.
data : {'string' : myString}.