Jump to content

jQuery/Ajax post data not being sent


-Karl-

Recommended Posts

Hello,

 

I'm using jQuery tabs and Ajax to send post data to an included page, but the data isn't being sent/received and I can't figure out why.

 

Here's my jQuery.

    $(function() { 
        var postData = {};

        $( ".tabs" ).tabs({  
            select: function(event, ui) {
                $('#r').html('<div style="padding: 5px;"><img src="<?php echo BASE_URL.'themes/'.$theme.'/images/ajax-loader.png'; ?>" /></div>');
                postData = {
                    uid: parseInt($(ui.tab).data('uid'))
                };
            },
            ajaxOptions: {
                type: 'POST',
                data: postData,
                error: function( xhr, status, index, anchor ) {
                    $( anchor.hash ).html(
                        "<div style='padding: 5px;'>Content could not be loaded, sorry about that.</div>" );
                }
            } 
        });
        $(".tabs ul li > a").attr('title', '');
    });

 

And here's the tabs.

    <div class="tabs">
        <ul>
            <li><a href="file1.php" data-uid="<?php echo $_GET['id']; ?>" title="r">File 1</a></li>
            <li><a href="file2.php" title="r" data-uid="<?php echo $_GET['id']; ?>">File 2</a></li>
            <li><a href="file3.php" title="r" data-uid="<?php echo $_GET['id']; ?>">File 3</a></li>
        </ul>
        <div id="r"></div>
    </div>

 

In file1.php I have a print_r($_POST);

 

But all that's shown is Array( ).

 

Does anyone have any ideas?

Link to comment
https://forums.phpfreaks.com/topic/267590-jqueryajax-post-data-not-being-sent/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.