Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing AJAX with jquery in asp form project on godaddy shared hosting
    text
    copied!<p>I have a modal popup as a users message inbox. When the user clicks the link to view a message I use jquery to display the message. The navigation around the messages display is all client side and nice and smooth. </p> <p>The problem I have been trying to solve is after a user clicks the message link to view the message I want to update the database to reflect this. I have a server side c# method that does this and I am trying to use ajax to get to it. Any other way and the page reloads and the message modal dissapears. </p> <p>My attempt was to put a button on the an update panel. This works and doesn't cause a full post back and the modal stays up. So my next step was to call the button from jquery when the function to display the message was run. Now it does a full page post and not a partial. </p> <pre><code>&lt;asp:UpdatePanel ID="UpdatePanel2" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:Button runat="server" ID="UpdateReadStatusButton" Text="test" OnClick="UpdateReadStatus"/&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <p>and then I call it with jquery</p> <pre><code>function ShowMyPopup(message, subject, sender, reciever, id) { ShowPopup(message, subject, sender, reciever, id); $('#ctl00_UpdateReadStatusButton').click(); } </code></pre> <p>I have tried to use another ways of ajax and I was able to call server side code quiet easily, and it worked very well, until I deployed. I tried the .net ajax wrapper from Micheal schwarz with no success after deployment either.</p> <p>The problem being is the site is hosted on godaddy shared hosting plan and any other methods of ajax I have tried will not work on their servers. I am now using the newest version of the AjaxControlToolKit, and this is a web forms app so easy solutions from MVC will not work. I am very new to ajax and web development in general and any help would be greatly appreciated.</p> <p>I was also thinking of setting the buttons commandArgument attribute with jquery because that is where I have the message Id and I can get it out on postback server side.</p> <p>If you would like a visual please see On2Wheels.ca and log in with user HelpUser and password HelpUser (notice the capitals.) and click the mail icon on the right.</p> <p>I have just tried the Jquery way to ajax:</p> <pre><code>function UpdateRead() { $.ajax({ type: "POST", url: "Default.aspx/UpdateReadStatus", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (result) { //do something } }); } </code></pre> <p>with a c# method of:</p> <pre><code> [System.Web.Services.WebMethod] protected void UpdateReadStatus(string id) { var a = id; } </code></pre> <p>I thought I could only call a method by url if I was using MVC. Also this is in a master page so it shows up on every page.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload