Sunday, January 2, 2011

ajax

I have a select drop down that triggers a change event to update my
database. I am new at programming, so hopefully I am overlooking
something obvious. My Jquery code actually works as desired to update
the database, but when I try to add a overlayed "loading, please wait"
message to the user, I can't get it to turn off and the page freezes.
debugging ithe javascript in Firebug, It seems this code returns a 404
status, so it makes sense to me that my overlay will not turn off, but
seems strange that the code updates the database as desired. what is
wrong with this code? How can I get the overlay to turn off?

<script type="text/javascript">
$(function(){
$('.share_choice').change(
function() {
var choiceValue = $('.share_choice option:selected').attr("value");
var userid = $('.share_choice').attr("name");
$('#TB_overlay').css('display', 'block');
$.ajax(
{
type: "POST",
url: "http://localhost/optional_share_users/select/" + userid +
"/" + choiceValue,
success: function(msg){
$('#main').html(msg);
$('#TB_overlay').css('display', 'none');
}
}
)
}
)
});
</script>

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: