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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.