1,105,578 Community Members

Jquery to post to a php file

Member Avatar
jayreis
Junior Poster in Training
88 posts since Apr 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

I have a jquery code below which I am using to try to get a html form that is displaied in a lightbox on a webpage to post to a php page my issue seems to be that when I click the "save" button it is not executing the jquery code below Can someone let me know if they see any errors in my below code

thanks

 $("#b_popup_4").dialog({autoOpen: false, 
                            modal: true,
                            width: 400,
                            buttons: {                            
                                "Save": function() {
                                    $.post('../includes/additem.inc.php', $('#additemform').serialize());
                                    //$( this ).dialog( "close" );
                                },
                                Cancel: function() {
                                    $( this ).dialog( "close" );
                                }
    }});
Member Avatar
Biiim
Posting Pro
504 posts since Oct 2011
Reputation Points: 85 [?]
Q&As Helped to Solve: 86 [?]
Skill Endorsements: 9 [?]
 
2
 

Heres one i got:

$.post("http://www.example.co.uk/test.php",{sid:sid,type:type},
        function(data){
            $('.jq_counttotal').html(data);
        }
    );

Looks like yours is missing the "what to do when got page" function

buttons: {                            
    "Save": function() {
        $.post('../includes/additem.inc.php', $('#additemform').serialize(), 
            function(data){
                alert(data);
            }
        );
    },
    Cancel: function() {
        $( this ).dialog( "close" );
    }
}
Member Avatar
jayreis
Junior Poster in Training
88 posts since Apr 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

thank you

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article