c# - My ASP.NET MVC AJAX request is opening my Content() in a new window -


i wondering whether guys me figure out i'm missing making ajax request return content in new window. trying follow post using ajax.beginform asp.net mvc 3 razor recipe book , apparently i'm missing something.

c:

   [httppost]     public actionresult addorganization ( string neworgname )     {          portaldata pd = new portaldata();          if ((from thisorg in pd.orgs thisorg.orgname == neworgname select thisorg).count() > 0)         {             return content("organization name '" + neworgname + " 'already exists in database!", "text/html");                        } // error if organization exists          pd.orgs.insertonsubmit(new organization { orgname = neworgname });          try         {             pd.submitchanges();         } // try submitting db         catch (exception e)         {             return content(e.message, "text/html");         }          // if made here,         return content(neworgname + " added database!", "text/html");     } 

m:

    </script>     <h3>or add new organization</h3>     @using (ajax.beginform("addorganization", "fileupload", new ajaxoptions { httpmethod = "post", insertionmode = insertionmode.replace, updatetargetid = "new-org-output-msg" }))     {         <input type="text" name="neworgname" />         <input type="submit" value="add" />     }     <p><i id="new-org-output-msg"></i></p> 

submitting, say, "stackoverflow" opens page source code nothing more than

stack overflow added database! 

whereas intention piece of text inside

<i id="new-org-output-msg"></i> 

this telling open content in new window:

 content(neworgname + " added database!", "text/html"); 

why not return string ajax call , in ajax success handler, display message should appear.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -