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

  • Home
  • SEARCH
  • 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 6746825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:22:06+00:00 2026-05-26T12:22:06+00:00

I’m working on a javascript function that when called will make a ajax request

  • 0

I’m working on a javascript function that when called will make a ajax request to a separate page. The separate page handles manipulating and displaying an array.

To display the list I use the function:

$('#pub-mod [name="userid"]').change(function() {
    var usr = $('#pub-mod [name="userid"]').val();
    if (usr != '') {
        $.ajax({
        url : 'ajax_admin_load_pubs.php',
        data: {'action' : 'load_'+usr},
        dataType : "text",
        success : function(response) {  
            $('#pub-mod-list').html(response);
        }
        });
    }
});

This function is working as intended, and if I place print_r($_GET); in the ajax file I have Array ( [action] => load_userid ) show up.

The function to edit the list looks like this:

function modify_pubs(action) {
    $.ajax({
        url : 'ajax_admin_load_pubs.php'
        data: {'action' : action},
        dataType : "text",
        success : function(response) {  
            $('#pub-mod-list').html(response);
        }
    });
}

This function is not working as intended, and if I place print_r($_GET); in the ajax file I have Array ( [action] => load_load ) show up.

I’ve verified that action in the second function is returning the correct value, and at this point I’m kind of at a lost as to what could be wrong.

Any ideas?

Answers to comments thus far:

I’m calling modify_pubs from text links generated by the code used to display it. (i.e. <button onclick="modify_pubs(userid_c_up);">up</button>

The portion for “modify_pubs(userid_c_up)” was checked by just having it alert the value being passed.

Also, I expect to see Array ([action] => text_string_from_action) – Charles Smith 3 mins ago edit

Action is a text string that is underscore delimited to run separate portions of the ajax code.

  • 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-26T12:22:06+00:00Added an answer on May 26, 2026 at 12:22 pm

    First of all, why not use POST instead of GET?

    And second, i do not know if this will help, but you are doing it wrong.

    According to the jQuery docs, you put the the location where you want your request to be sent into the “url”, and the data you want to send in “data”, you do not combine the 2 in the url, so maybe this will work. (Using .get() instead of .ajax())

    $.post("ajax_admin_load_pubs.php", { "action": action},
       function(response){
           $('#pub-mod-list').html(response);
       }, "text");
    

    And with just a little edit of your example:

    function modify_pubs(action) {
        $.ajax({
            url : 'ajax_admin_load_pubs.php',
            data : {"action" : action},
            dataType : "text",
            type : 'post',
            success : function(response) {  
                $('#pub-mod-list').html(response);
            }
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm making a simple page using Google Maps API 3. My first. One marker
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I'm trying to create an if statement in PHP that prevents a single post

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.