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

The Archive Base Latest Questions

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

Here’s my situation: i have a dialog form that inserts some data on my

  • 0

Here’s my situation: i have a dialog form that inserts some data on my database. After everything is validate, the form info is turned to a database object (i’m using linq to sql) and is submitted.
Since i’m doing this using jquery ajax, i have a success function that displays some message to the user (just to inform him that his action was successful), closes my dialog and refresh my main page. And that’s the problem, none of the success actions are occuring due some strange download window that’s showing up, asking me if i want to download my controller action (you’ll se on my code).

Here’s the reducted code:

JQuery Submit Function

     //Submete a nova solicitão ao servidor e atualiza a página em caso de sucesso
            $("#novaSIForm").submit(function (e) {
                e.preventDefault();
                $.ajax({
                    type: "Post",
                    url: $(this).attr("action"),
                    cache: false,
                    data: $(this).serialize(),
                    success: function (data) {
                        //Fecha a modal
                        $("#novaSIModal").dialog("close");
                        //Após a requisição ter sucesso, atualiza a página
                        $("#SiContainer").load('@Url.Action("SolicitacoesInternas")');

                        alert(data.msg);
                    },
error: function (jqr, errorStatus, errorThrow) {
                    alert("Erro ocorrido " + errorStatus);
                }
                });

                return false; //Isso faz com o que o form não execute sua ACTION
            });

ACTION

public ActionResult SiNovaSI(ChamadoViewModel chVM, string tituloChamado)
        {
            try
            {
                CHAMADO ch = new CHAMADO();

                ch.InjectFrom(chVM);//Injeta os valores da ViewModel no novo Chamado criado
                //Seta outras propriedades que não foram injetadas anteriormente
                ch.DATAINICIO = DateTime.Now;
                ch.SOLICITANTE = ((USUARIO)Session["UsuarioLogado"]).NOMEREDUZIDO;
                ch.STATUS = "SOLICITADO";
                ch.VALORDEBITO = ((DEBITO)Session["Debitos"]).VALORPARCELA;


                ChamadoManager chMan = new ChamadoManager();

                chMan.InsertCHAMADO(ch);//Insere o novo chamado no banco de dados

                return Json(new { sucesso = true, msg = "Chamado cadastrado com sucesso" });
            }
            catch (Exception e)
            {
                return Json(new { sucesso = false, algo = "Nao foi possível registrar o chamado. Erro: " + e.Message });
            }

        }

Image

enter image description here

Oh, i forgot to mention that i have included all the necessary jquery scripts. Including some MS Ajax scripts (even though i’m no longer using it).

  • 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-24T05:14:58+00:00Added an answer on May 24, 2026 at 5:14 am

    If this #novaSIForm was dynamically generated (maybe after an AJAX call) you might loose your .submit handler if the DOM element is replaced. So you could use the .live method. Also make sure that this event subscription happens inside the document.ready event handler (in the case you are using .submit instead of .live)

    $('#novaSIForm').live('submit', function() {
        ...
        return false;
    });
    

    Also inspect with FireBug the actual AJAX request that is being sent and that there are no javascript errors occurring.

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

Sidebar

Related Questions

Here's a problem I ran into recently. I have attributes strings of the form
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here, i have coded to get data from DB. I want to store the
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote
Here is my code, which takes two version identifiers in the form 1, 5,
Here's a coding problem for those that like this kind of thing. Let's see
Here is the scenario: I'm writing an app that will watch for any changes
Here we go again, the old argument still arises... Would we better have a

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.