Note that there are some explanatory texts on larger screens.

plurals
  1. POwhy success: function() doesn't work
    text
    copied!<p>I'm fairly new to J-QUERY and JavaScript. I have several forms that use some JavaScript to collect data and submit to an asp page to handle the request (edit user data, add information, delete, etc) which calls a T-SQL procedure. The process works fine but I need to add some checks and alert messages but I'm unsuccessful. Here is a sample</p> <pre><code>$("#add-user-form").dialog({ autoOpen: false, height: 300, width: 420, modal: true, buttons: { 'Add User': function () { var bValid = true; allFields.removeClass('ui-state-error');`enter code here` bValid = bValid &amp;&amp; checkLength(loginname, "Login Name", 3, 10); if (bValid) { var statusdataString = '?section=adduser&amp;loginname=' + loginname.val() + '&amp;fullname=' + fullname.val() + '&amp;type=' + type.val(); $(this).dialog('close'); $.ajax({ type: "GET", url: "admin.asp" + statusdataString }); } window.location.reload(); }, Cancel: function () { $(this).dialog('close'); } }, close: function () { allFields.val('').removeClass('ui-state-error'); } }); </code></pre> <p>This is the asp section that is invoked </p> <pre><code>if (section = "adduser") then edituser_sql = "Exec add_user " &amp; "'" &amp; request("loginname") &amp; "','" &amp; request("fullname") &amp; "'," &amp; request("type") Conn.execute edituser_sql Conn.close set Conn = nothing set dsn = nothing end if </code></pre> <p>Now here are my issues:</p> <ol> <li><p>I need to put an alert once all of this is done to say "user added" or "Duplicate user" etc. I have tried adding it after success: like so </p> <p>$.ajax({ type: "GET", url: "admin.asp"+statusdataString, success: function(){alert("something")} </p> <p>});</p></li> </ol> <p>but it doesn't work. I have also try to save the results the procedure returns, which tells me if they user was added or not, and then within the asp code do this </p> <pre><code>if results= -1 then %&gt; &lt;Script type="text/JavaScript"&gt; alert("something"); &lt;/script&gt; &lt;% </code></pre> <p>But that doesn't work either. I think I understand the process but I'm not sure how all of this code works, just bits and pieces. Your help would be highly appreciated</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