I'm trying to post a variable to my php handler page, that tells php to ether add a certain form field's data to the database or not, but for some reason my post function will not post any thing. I am using the codeigniter framework, for the php side of things and jquery for the JavaScript side of things. I am thinking it may have to do with the URL I'm passing as the page to post to sense it's not a .php page or something like that, but I'm not sure. any help would be greatly appreciated.
$('form').submit(function() {
if(new_gal) {
if(name_valid && description_valid && gal_name_valid && gal_description_valid) {
// return the new gal info to php
$.post('http://localhost/index.php/site/photoUploader', {NewGallerry: 'TRUE'});
return true;
} else {
return false;
}
} else if (name_valid && description_valid)
{
// return the id of the gal to php and tell php not to add the info in the new gal section.
开发者_如何学Python $.post('http://localhost/index.php/site/photoUploader', {NewGallerry: 'FALSE'});
return true;
} else {
return false;
}
thank you so much to any one who spends the time attempting to answer this.
try :
{'NewGallerry': FALSE}
instead of :
{NewGallerry: 'FALSE'}
anyway firebug console always helps you with ajax ;)
Your code uses localhost. Change it to your website. Javascript is executed solely on the client, not the server.
精彩评论