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 7549537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:58:08+00:00 2026-05-30T09:58:08+00:00

.ajax() can send a post request and get data in return where as .load()

  • 0

.ajax() can send a post request and get data in return where as .load() can get any element in the rendered page. How to create a form when submitted(asynchromously) instead of getting back some data should get the page element of the rendered page that would be generated had there been normal submission instead of ajax submission?

I dont want to write views(Django) for xhr, normal requests separately. So, When I submit a form by ajax I dont want to hijack default action but only want to get some element of the rendered post submission page instead of actually being redirected to that post submission page which would have happened hadn’t it been an xhr request.

  • 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-05-30T09:58:09+00:00Added an answer on May 30, 2026 at 9:58 am

    Update:

    load will do a POST rather than a GET if you supply the data to send as an object rather than a string. From the docs:

    Request Method

    The POST method is used if data is provided as an object; otherwise, GET is assumed.

    So:

    $("#target").load("/path/to/resource selector_for_relevant_elements", {});
    

    ..should convert the load from GET to POST. Of course, you’d replace {} with the arguments you want to send.


    Original answer:

    You can do the POST directly with ajax and then process the returned HTML yourself. For instance, to turn this load:

    $("#target").load("/path/to/resource selector_for_relevant_elements");
    

    ..into a POST:

    $.ajax({
        url: "/path/to/resource",
        method: "POST",
        dataType: "html",
        success: function(html) {
            // Build the elemnts of the result in a disconnected document
            var page = $("<div>").append(html); // See note below
    
            // Find the relevant elements and put them in target
            $("#target").html(page.find("selector_for_relevant_elements"));
        }
    });
    

    I’ve done the wrapper div because that’s what jQuery’s load function does. You may want to look at the source for load (that line number will rot, of course, but the filename is unlikely to change) to see if there are other tricks you need to replicate.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to send the node instance JSON data using an ajax get request
I am send request to PHP page by using jquery ajax concept, I have
I have a situation where I send jquery ajax post request but in my
I am making an Ajax POST Request and it does not get recognized in
I basically want to make an ajax post to send some stateId and get
How do I send AJAX data through $.ajax() in JavaScript via type: POST using
When I send a request from JSP FORM, the server side automatically parses data
Can an Ajax-enabled WCF Service pass back a DataTable as a Sys.Data.DataTable? Like this
I am starting to use the jquery $.ajax() but I can't get back what
Can you do ajax on ASP.net webform without using ajax toolkit? (Please post a

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.