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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:29:08+00:00 2026-06-11T12:29:08+00:00

var url = base_url+ajax/user/list_user_info/+userId; $.ajax({ type: POST, url: url, data:{user_id:userId}, contentType: ‘application/json’, dataType: ‘JSON’,

  • 0
var url =  base_url+"ajax/user/list_user_info/"+userId;
$.ajax({
        type: "POST",
        url: url,
        data:{user_id:userId},
        contentType: 'application/json',
        dataType: 'JSON',
        success: function(data) {

            if(data.redirect){
                window.location = data.redirect;    
            }
            else {
                $('#profile-main-content').html(data.html);
            }    
        }      
    });

Now, this is my request, a pretty standard AJAX request. My problem is that this request is not reaching the controller for some reason. To check I have performed a simple test insert in the database to check the result at first line of the controller’s function. But the test does not get inserted. The url is correct because i checked the declaration of the base_url. I know I put the “userId” as an argument and passed it as POST data, but this is me just trying desperately. Any Ideas please? Let me know if i was not clear about anything. Thanks.

  • 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-11T12:29:10+00:00Added an answer on June 11, 2026 at 12:29 pm

    Instead of:

    data:{user_id:userId}
    

    try:

    data: JSON.stringify({user_id:userId})
    

    The reason for this is that you specified a request content type of application/json so you need to send JSON. In your code you are not sending a JSON request – you are sending a simple application/x-www-form-urlencoded POST request. And since you have already passed the userId in the POST body you probably don’t need to repeat it in your url. Use either one or the other method to send this information to your server.

    Also in order to more easily debug javascript errors I strongly suggest you to use FireBug. Among many things it allows you to see the exact requests/responses being sent during an AJAX call and analyze the exact error message you are getting from the server. It makes debugging problems much easier.

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

Sidebar

Related Questions

$(.overlay).lightbox(); $('.overlay').live('click', function(e){ e.preventDefault(); var url = base_url + 'ajax/getcolorboxhotel'; var data = $(this).next('span').text();
i have the following javascript in my view: $.ajax({ url:<?php echo site_url('switches/showknownvlans/'.$ip.'/'.$hardwaremodel);?>, type:'POST', dataType:'json',
<?php while($data['user'] as $row){ <input type=check value=<?php echo $row ?> class=userid /> } ?>
here's my code with jquery: function check_hotel_exists(value, col) { var url = base_url +
I have the JS-code: $(#select_bank).change(function () { selected_bank = $(#select_bank option:selected).text(); $.ajax({ type: 'POST',
I develop following js in my view. var url = '<?php echo base_url(); ?>edit/';
$(document).ready(function() { var user_id = document.getElementById('sessuid').value; //alert(user_id); //$('a.jtebizcard').attr('rel','<?php echo base_url();?>gl_profile/gl_getbig').cluetip({ $('a.jtebizcard').cluetip({ //alert(user_id); local: true,
I'm having trouble returning data from my controller using an ajax post function. What
I have this code: <div id=gll_select> <script> var caffe = $(#caffe).val(); $(#gll_select).load(<?php echo base_url()
my script: var Url = 'http://readonline.egscans.com/Remnant/Chapter_036_[END]'; var response = UrlFetchApp.fetch(Url).getContentText(); I get this error

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.