Ajax requests with jQuery.post()

DISCLAIMER: This post may contain “affiliate” links to products and services I recommend. I’ll receive a small commission if you decide to purchase one of these products or services. I only recommend products I genuinely believe will help you in running your freelance business.

This is one of the reasons I still like jQuery.

I’m sure all the new frameworks do similar stuff, but things like this are so simple with jQuery. Anyway, jQuery.post() is a shorthand Ajax function. It’s the equivalent of doing this:

$.ajax({
  type: "POST",
  url: url,
  data: data,
  success: success,
  dataType: dataType
});

So, with it, you can send an Ajax request this easily:

var posting = $.post(url, data);

Then, handle the response like this:

posting.done(function(data) {
    // Handle data here
});

Or, all together like this:

$.post( "process.php", function( data ) {
  $( ".result" ).html( data );
});

It really is pretty simple.

Anyway, in my latest course I show you how to grab the form data from an HTML form, send it to a PHP script to be processed, generate a response in JSON and then handle that response in your jQuery to create an Ajax-powered quote request form on your website.

If you haven’t got into Ajax or jQuery, this is a good place to start because you get to see the whole request “loop” in a simple script that you can understand even if you’ve never done any of this before.

And, that’s along with learning about CSS Grid, CSS transitions, a little PHP and more.

Anyway, link to get no-cost access to the course here: https://skl.sh/2xM6Y3l

Later,

John

Do you want high-paying freelance clients?

I’ll show you what I learned over the last 15 years about building a 100K freelance business from complete scratch. What I did to land projects with Inc. Magazine, Tim Ferris, Lewis Howes, Michael Hyatt and others. Just enter your email address in the box below and let’s get started:

Leave a Reply on Twitter

Due to excessive spam, I’ve disabled comments on my website. If you have a question or would like to leave a comment, don’t hesitate to contact me on Twitter.

You might also like

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Share on reddit
Reddit
Share on pinterest
Pinterest
John Morris

JOHN MORRIS

I’m a 15-year veteran of freelance web development. I’ve worked with bestselling authors and average Joe’s next door. These days, I focus on helping other freelancers build their freelance business and their lifestyles.

The simple secret to high-paying freelance clients?

Enter your email below and I’ll show how to charge more and build a 100K freelance business from scratch:

Clients Like:

Inc. Magazine Logo
Lewis Howes Logo
Ray Edwards Logo

WHAT OTHERS ARE SAYING

Xan Barksdale

Xan Barksdale

Very professional worker who is extremely knowledgable in WordPress and Wishlist Member. I would definitely hire again.

Chris Aitken

He significantly improved my site through his expert knowledge of PHP, CSS and Javascript. Would definitely recommend John to others.

Lori Grant

John did an outstanding job on my project. I highly recommend him and look forward to working with him on future projects.

Ray Edwards

I recommend John every chance I get. If every person I worked with were as committed to excellence, punctuality, value, and unquestionable integrity… the world would be a better place. Highest recommendation.

Bradley Smith

John and I have worked together on numerous projects. John is very quick and efficient and was a pleasure to work with.

Daniel Mohlendick

On the Freelancing on Upwork course: “This is by far the best course i have watched on Skillshare!! Thank you so much.”

Thabo Motsoahae

John is one of the best instructors I have come across, I learned a lot from his online tutorials.