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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:17:48+00:00 2026-06-10T03:17:48+00:00

see this HTML markup: <input value=9961 name=c_id id=c_id type=hidden> <input name=user_id id=user_id value=1 type=hidden>

  • 0

see this HTML markup:

<input value="9961" name="c_id" id="c_id" type="hidden">
<input name="user_id" id="user_id" value="1" type="hidden">
<textarea id="comments" name="comments" style="width: 310px; resize: none; height: 75px"></textarea>

Then I write this code in jQuery to send this data through .post:

$("#dialog-form").dialog({
    autoOpen: false,
    height: 220,
    width: 350,
    resizable: false,
    modal: true,
    buttons: {
        "Ok": function () {
            if ($('#comments').val() != '') {
                $.post("<?php echo site_url('wall/comment') ?>", {
                    value: $("#comments").val(),
                    user_id: $('#user_id').val(),
                    c_id: $("#c_id").val(),
                    is_post: true
                });
                $(this).dialog("close");
                $(location).attr('href', "<?php echo site_url(); ?>");
            }
        },
        "Cancelar": function () {
            $(this).dialog("close");
        }
    },
    close: function () {
        $("#comments").val("");
    }
});

But for some reason isn’t working but because I use .post method I can’t find where it fails meaning if is jQuery or if it’s the server side part.

EDIT
This is the PHP code that gets data and run the queries that basically is a INSERT:

    public function comment() {
        role_or_die('wall', 'comment', site_url(), lang('wall:no_permissions'));

        $message = $this->input->post('value', TRUE);
        $post_id = $this->input->post('c_id', TRUE);
        $user_id = $this->input->post('user_id', TRUE);

        $this->load->library('user_agent');
        $device = "";

        if ($this->agent->is_browser()) {
            $device = $this->agent->browser();
        }

        if ($this->agent->is_mobile()) {
            $device = $this->agent->mobile();
        }

        if ($this->wall_comment_m->insert(array('friend_id' => $user_id, 'message' => $message, 'post_id' => $post_id, 'device' => $device))) {
            $this->session->set_flashdata('success', lang('message:comment_add_success'));
        } else {
            $this->session->set_flashdata('error', lang('message:comment_add_error'));
        }
    }

I can’t see if the SQL generated is the mistake or if data isn’t set at server side because of the location.href.

How I can find where it fails? Any method or something tool to get this done?

  • 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-10T03:17:50+00:00Added an answer on June 10, 2026 at 3:17 am

    $.post is asynchronous. That means that it runs in the background.

    So, the $(location).attr('href', "<?php echo site_url(); ?>"); will run before the POST finishes.

    You need to use $.post‘s callback.

    var that = this;
    $.post("<?php echo site_url('wall/comment') ?>", {
        value: $("#comments").val(),
        user_id: $('#user_id').val(),
        c_id: $("#c_id").val(),
        is_post: true
    }, function(){
        $(that).dialog("close");
        $(location).attr('href', "<?php echo site_url(); ?>");
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please see this example: if (strlen($_SESSION['userDetails']['THISNAME']) == 0) { $_SESSION['userDetails'][''.$THISNAME.'Error'] = autofocus; include $docRoot/html/forms/reg/user_info.html.php;
I'm using the Google Maps API. Please see this JSON response . The HTML
You can see an interesting table at this link. http://norvig.com/21-days.html#answers The table described, Mutex
See this code: var jsonString = '{id:714341252076979033,type:FUZZY}'; var jsonParsed = JSON.parse(jsonString); console.log(jsonString, jsonParsed); When
See this simple HTML code: http://www.pastie.org/3540274 On modern browsers and even IE8 and IE9
Why isn't the markup for the hidden input field showing up when i use
I came accross this html multiple file upload tutorial: http://robertnyman.com/2010/12/16/utilizing-the-html5-file-api-to-choose-upload-preview-and-see-progress-for-multiple-files/ I'm new to web
Ie., follow this link: http://googleblog.blogspot.com/2012/04/toward-simpler-more-beautiful-google.html Notice, you'll see some spinning gears, and then the
See this question. How to show popup message like in stackoverflow I am trying
see this fiddle . This upon running gives an error in console. I'm currently

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.