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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:14:43+00:00 2026-05-24T10:14:43+00:00

I’m using jQuery dialog to load a view, which is used to upload files

  • 0

I’m using jQuery dialog to load a view, which is used to upload files to my application. Upon browsing to the file and clicking submit, a controller is called, which processes the file and passes it to my model for insertion. The model then returns back to the controller, success (or not) and loads a new view for success (or not).

I would like to have the success (or not) view render inside the same jQuery dialog (or open a new one) instead of calling/loading an entire view.

Would I call/load (somehow) the jQuery dialog from within my controller? Or would I have my controller call the new view, and once it loads, have it render the dialog, basically rendering itself in the dialog? Hope this makes sense.

Thanks.

**EDITED: ADDED CODE BELOW + COMMENTS – Thanks! **

My intial view contains the following jQuery function, which is called when a user clicks on an anchor (“upload file”):

$(document).ready(function(){
 function uploadImage(event) {
          id = $(this).data('id'); //id is an URL such as ('upload_form'/do_upload/5) it calls my controller (uploadimage), and passes a value (5) to a function (doupload)

          $("#dialog").load(id).dialog(); //loads the URL    
         return false;
    }

$('.imageBtn').live('click',uploadImage);     
});

The function called by the controller:

function do_upload()
    {
        $config['upload_path'] = './uploads/';
        $config['allowed_types'] = 'gif|jpg|png';
        $config['max_size'] = '0';
        $config['max_width']  = '212';
        $config['max_height']  = '118';

        $this->load->library('upload', $config);    
        if ( ! $this->upload->do_upload())
        {
            $data['id'] = $this->input->post( 'iEventID', true );    
                        $data['error'] = $this->upload->display_errors();
            $this->load->view('admin/upload_form', $data); // If an error is found during file/img upload, then the code reloads the view that was previously loaded into my dialogue. This is where I need the same view to reload in the dialog and present the error message. This currently loads the view in its entirety in a browser window.
        }
        else
        {
            $upload_data = $this->upload->data(); 
            $filename = $upload_data['file_name'];    
            $this->event_model->addEventImage($filename);
            $this->load->view('admin/upload_success');  // If all is well, instead of loading the view in its entirety, I want to load the success into the dialog previously popped.
        }
    }
  • 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-24T10:14:43+00:00Added an answer on May 24, 2026 at 10:14 am

    var $dialog; function showDialog(html, status,request) { $dialog.dialog(‘open’); $dialog.html(html); return false; }

    $(document).ready(function() { $dialog = $(”).dialog({ autoOpen: false, modal : true, title : ‘Export Dialog’, buttons: { ‘Ok’: function() { jQuery().download( ‘<%=submitURL%>’, $data, function(){ jQuery(‘#wait’).hide(); $dialog.dialog(‘close’); }, ‘post’); }, ‘Cancel’: function() { jQuery(this).dialog(‘close’); } } });

    $(‘#popup’).click(function() { jQuery.ajax( { url : ‘<%=submitURL%>’, dataType : ‘String’, success : showDialog, data : ‘data’, type : ‘post’ }); });

    couldnt format!!!

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

Sidebar

Related Questions

I used javascript for loading a picture on my website depending on which small
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to
I am using Paperclip to handle profile photo uploads in my app. They upload
I am reading a book about Javascript and jQuery and using one of the
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
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.