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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:46:54+00:00 2026-06-03T01:46:54+00:00

I’m trying to return the generated HTML string to the view to dynamically generate

  • 0

I’m trying to return the generated HTML string to the view to dynamically generate a HTML table with results. I’m not able to get the returned HTML string any suggestions and help is greatly appreciated.

Here is my Controller code

    public ActionResult ValidateTrams()
    {
        string html = "";
        if (Request.Files.Count == 0 || Request.Files[0].ContentLength == 0)
        {
        }

        else
        {
            html = ProcessTextFile(Request.Files[0].InputStream);
        }

        return View(html);
    }

I’m trying to grab this returned result in jquery like this

$('#tramsView').live('click', function () {

$.ajax({
    url: '/Booking/ValidateTrams',
    type: 'POST',
    dataType: 'jsonp',
    success: function (data) {
        alert(data);
        $('#TramsViewFrame').html(data);
    },
    error: function (jqxhr, textStatus, errorThrown) {
        $(window).hideWaitScreen();
        if (confirm(errorThrown)) { window.location.reload(); }
    }
});

});

Finally Below is the CSHTML for the form. Here I’m reading a file from a form with a button type submit

<form action="#" method="post" enctype="multipart/form-data" class="forms" name="form"
            id="frmvalidate">
            <table>
                <tr>
                    <td>
                        <input type='file' name='trams' id='ValidatetramsFile' />
                    </td>
                </tr>
                <tr>
                    <td>
                        <br />
                        <input name="cbDisplayUmatched" id="cbDisplayUmatched" type="checkbox" value="" checked="true" />
                        <label style="text-decoration: none; outline: none; font-size: 1.1em; padding: 3px 0 0px 0;">
                            Display rows that were <strong>NOT</strong> parsed</label>
                    </td>
                </tr>
                <tr>
                    <td>
                        <br />
                        <div class="buttons">
                            <button type="submit" value="VIEW" class="ui-state-default ui-corner-all" id="tramsView">VIEW</button>
                        </div>
                    </td>
                </tr>
            </table>
            </form>

Thanks for your time and really appreciate your help. Kind Regards!!!

  • 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-03T01:46:55+00:00Added an answer on June 3, 2026 at 1:46 am

    It sounds as if your form is still submitting a normal postback, so any asynchronous calls that you’re doing are being lost.

    Try preventing the default form submission taking place with the following:

    $('#tramsView').live('click', function (evt) {
    
        evt.preventDefault();
    
        // ... rest of your code 
    
    });
    

    Incidentally, in this case, if all you’re doing is updating the html on your #TramsViewFrame, you could just use the slightly simpler $.load() method:

    $('#tramsView').live('click', function (evt) {
        evt.preventDefault();
        $('#TramsViewFrame').load('/Booking/ValidateTrams');
    });
    
    • 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
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
i got an object with contents of html markup in it, for example: string
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I am trying to understand how to use SyndicationItem to display feed which is
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 want to count how many characters a certain string has in PHP, but

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.