Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7861645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:48:33+00:00 2026-06-02T22:48:33+00:00

I am using PJAX and it is working great for simple examples, but I

  • 0

I am using PJAX and it is working great for simple examples, but I need to be able to do a few advanced things with the PJAX requests.

  1. I would like to append some data to each PJAX request. The data I want to append is actually an array of objects. See example below.
  2. I may need to use POST rather than GET for the ajax call.
  3. I may need to change the content-type to “application/json”.

I have the following…

var people = [{ first: "John", last: "Doe" }, { first: "Jane", last: "Smith" }];

$("a.sheet-link").pjax("#content");

$('#content').on('pjax:beforeSend', function (e, jqXHR, settings) {

  // Modify ajax request here?
  // Would like to append the people array to data
  // Would like to POST rather than GET
  // May need to change content-type to "application/json".

});

I have tried a variety of approaches…

  • using the jQuery.ajaxSetup to set some default values (I can set data, but then the _pjax data element is not appended; I tried to set the type to POST, but that did not stick.)
  • trying to modify the jqXHR object in the beforeSend handler
  • trying to modify the settings object in the beforeSend handler

All attempts give me various issues.

I am not sure why this is so difficult. Any help would be greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T22:48:34+00:00Added an answer on June 2, 2026 at 10:48 pm

    Since the documentation points out:

    You can also just call $.pjax directly. It acts much like $.ajax, even returning the same thing and accepting the same options.

    I would try the following:

    var people = [{ first: "John", last: "Doe" }, { first: "Jane", last: "Smith" }];
    
    $('a.sheetlink').click(function(e) {
      e.preventDefault();
      $.pjax({
        type: 'POST',
        url: $(this).href,
        container: '#content',
        data: people,
        dataType: 'application/json'
      })
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Rails 3.2.0 with haml and sass: I Would like to link an external
I am using PJAX https://github.com/defunkt/jquery-pjax and I was wondering since the whole page does
Hey so I am using Rails PJAX for my web application with twitter bootstrap
Using of mobile dialog authentication is working well for other mobile devices except on
using SQL Server 2005 standard edition with SP2 I need to design a table
Using the navigator.geolocation object in JavaScript. Trying to establish accurate ranges, but wondering exactly
Using NSDateComponents I know how to get the day component, but this gives me
i'm using the jquery Pjax plugin from Chris Wanstrath, aka, Defunkt, demo'd here: http://pjax.heroku.com
Personally Coffeescript is ok, but I would rather it be a supporting player in
using a binary search tree I need to add to a vector all int

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.