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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:13:24+00:00 2026-05-23T11:13:24+00:00

I’m having problem trying to request new page(s) from CodeIgniter using JQuery Ajax and

  • 0

I’m having problem trying to request new page(s) from CodeIgniter using JQuery Ajax and open them in a new blank page

The following is the example scenario of current code which is working,

1.) User select the customer’s receipt by checkbox

<input type='checkbox' class='customer_id' value='<?php echo $entry->customer_id;?>'>

2.) Javascript read the customer(s) id then send those data to CodeIgniter. Once return data is received, fire callback function to display them target div

var data;
var counter = 1;
$(.customer_id:checked).each(function(){
    data['customer_' + counter] = $(this).val();
})    
$.post('finance/getReceipt', data, function(){
    $('#some_target_div').html(data);
}

3.) CodeIgniter retrieve customer data from db and generate page

function getReceipt(){
    $counter = 1;
    while ($this->input->post('customer_' + $counter)){
        $where['customer_id'] = $this->input->post('customer_' + $counter);
        $data += $this->getCustomerReciept($where);
    }
    $this->load->page('finance/receipt', $data);
}

But now I need to convert this code to make it open a new blank page with a print button

The purpose of this is because I want to generate a formatted receipt and display in a new blank page with a print button. I know that there are several plugin that I can print a div but this is the request from my client. So, that’s isn’t a solution for me.

Any suggestion or comment will be great. Thank in advance.

  • 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-23T11:13:25+00:00Added an answer on May 23, 2026 at 11:13 am

    I think the easiest way would be to create an auxiliar form to post your data to a new page instead of using $.post So, this would be the code:

    var data;
    var counter = 1;
    $(.customer_id:checked).each(function(){
        data['customer_' + counter] = $(this).val();
    });
    $('<form action="finance/getReceipt" method="POST" target="_blank" style="display:none">' +
    '<input type="hidden" name="data1" value="value-data1" />'
    ).appendTo("body").submit().remove();
    

    Just change your data1 param to the one you want, or add more if you want.
    And that’s it. The magic is in using a _blank target for the form.

    Hope this helps. Cheers

    PS: The other way would be creating a new window with window.open and assign its content with javascript.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am currently running into a problem where an element is coming back from
We're building an app, our first using Rails 3, and we're having to build
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm making a simple page using Google Maps API 3. My first. One marker
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is

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.