I'm succesfullt making a $.ajax call and can even get a javascript alert to show that it was successful but when I try and use a toast nothing happens. I added the toast plugin and see it in the plugin directory, I also added in my config.xml.
Below is my javascript:
App.init = function () {
App.utils.metaHack();
$(document).ready(function() {
$("#regsubmit").click(function(){
var formData = $("#adduser").serialize();
alert(formData);
$.ajax({
type: "POST",
url: "http://www.hedonsoft.com/tcob/php/register.php",
cache: false,
dataType:"text",
data: formData,
success: showCustomToast
});
return false;
});
});
$('#landing').live("pagecreate", function(){
navigator.geolocation.getCurrentPosition(App.getLocation);
});
$("#bb_activity").live("pageinit", function(){
App.page.bb_activity.init();
});
$("#togglePage, #togglePageDark").live("pageinit", function(){
App.page.toggle.init();
});
$("#actionBarSample").live("pageinit", function() {
App.page.actionBarSample.init();
});
$('#applicationMenu').live("pageinit", function() {
App.page.applicationMenu.init();
});
}
function showCustomToast(data, status) {
if(data=="SUCCESS"){
var message = 'This is a simple Toast';
blackberry.ui.toast.show(message);
}
}
What am I missing?
It looks like you have everything setup right, plugin added, etc. You shouldn't have to add it to the config.xml as the sdk is supposed to handle this part for you.
After doing a
webworks build
you can double-check that the config.xml file has been properly updated by going to the platform/blackberry10/www directory and opening the config.xml file from there. It should have the feature elements added for you.The best way to troubleshoot at this point is to use remote web inspector. It'll show any errors that may be present in the Console.