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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:20:40+00:00 2026-05-27T14:20:40+00:00

I am using $.ajax jquery method, to post num to php, but im not

  • 0

I am using $.ajax jquery method, to post num to php, but im not sure how to pick it up on the php side, this is what i have, gives an undefined index error on num so its not finding it.

I would like to know how to pick the variable up in php after posting it there via the $.ajax method.

<?php 

$lol =  $_POST['num'];

echo " $lol";


?>

this is the JS:

<script>
 var num = 1;
                    function ajax_post(){ 
$.ajax('javas.php', {
success: function(response) {
      $(".status").html(response);
}, 
data: "num=" + (++num)
});
}

function ajax_posta(){
$.ajax('javas.php', {
success: function(response) {
      $(".status").html(response);
}, 
data: "num=" + (--num)
});
}

$(document).ready(function() {
$('.eventer > .button').click(function () {
    ajax_post();
});
alert("lol");
});


</script>

This JS is carried out on click of a button

  • 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-27T14:20:41+00:00Added an answer on May 27, 2026 at 2:20 pm

    $.ajax uses GET by default, so either use $_GET instead of $_POST in your PHP script, set the type setting in your $.ajax() call to "post", or use $.post() (which uses $.ajax internally).

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

Sidebar

Related Questions

I currently have a JQuery Ajax method as below; $.ajax({ type:POST, url: default.aspx/UpdateData, data:
I'm trying to submit a simple jQuery ajax call but using the DELETE method
I am using JQUERY ajax to call an MVC method: JQUERY: $.ajax({ type: POST,
I'm using an ajax enabled wcf service with a jquery POST method which gets
I have a page method which returns a list of integers using jQuery.ajax(); .
I am using the JQuery .post method to get data using an AJAX call.
i'm loading, using the JQuery ajax() method, an external page with both html and
I am using jQuery ajax to pass a string array to a page method.
I'm loading a page containing a GMaps using the ajax() method of jQuery. The
When using jQuery 's ajax method to submit form data, what is the best

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.