0
votes

I have a fancy box with the follow code:

$("a#inline").fancybox({
    'titleShow'     : false,
    'width'         : 500,
    'height'        : 500
    });

And a $.post calling when submit button in fancybox clicked.

$("#submitbtn").live('click',function(){
    var timesch = $("#timesch").val();
    var actsch = $("#actsch").val();
    var postdata ="timesch=" + timesch + "&actsch=" + actsch;

    //$.fancybox.showActivity();
    $.post("insertsch.php",postdata,function(data){
            alert(data);
    });

});

The matter is the alert(data); doesn't pop back what it suppose to in the success call. I've tested the content in php insertsch.php it work normally but not when it passing back to the success....

in insertsch.php code:

<?php
    //bla bla insert into database then echo this success
    echo "success";
?>

**Note alert(data) is simply just to post back echo "success" in the insertsch.php to test the callback working or not and it doesn't somehow.

Found the problem cause I didn't return false after ajax posting...

1
I would suggest you check to make sure your request is going through. In Chrome there's the Network Panel, Firefox the Firebug addon, etc.mattsven
if u mean my .post, it is working as the inserting happening.Eric T
You said "the alert(data); doesn't pop back what it suppose to in the success call". What does it pop back?Kevin Ennis
kennis as above insertsch.php echo success to try and error before working in the internal success callback/ What I did is doing the alert(data) to pop success to make sure it works.Eric T
Yeah, I get that. My question is: does the alert not fire at all? Or does it fire, but display something other than "success"?Kevin Ennis

1 Answers

0
votes

Your post data needs to be in an object literal. Try this:

var postdata = {timesch : timesch, actsch : actsch};