Javascript code makes page reload?
-
hi, could you please tell me why this code makes the page reload? $(function() { $("#delete1").click(function() { var delete_name = $("#delete_name").val(); var delete_comment = $("#delete_comment").val(); var dataString = 'delete_name='+ delete_name + '&delete_comment=' + delete_comment; $.ajax({ type: "POST", url: "../comments/delete_comment.php", data: dataString, cache: false, success: function(html){ $("#flash").show(); $("#flash").fadeIn(400).html(' <span style="color:#F60;" align="absmiddle"><B>Your Comment Has Been Deleted</B></span> '); } }); alert ('hmm'); }); }); i made it using an older code and that one doesnt make the page reload.
-
Answer:
http://api.jquery.com/jQuery.ajax/ I would try removing the cache: false, line and modifying my success function.
Ilyakar at Yahoo! Answers Visit the source
Related Q & A:
- How to refresh or reload a page in jquery mobile?Best solution by Stack Overflow
- Why is Javascript called Javascript, if it has nothing to do with Java?Best solution by Stack Overflow
- how to reload tslib touch calibration?Best solution by Stack Overflow
- How to encrypt JavaScript code?Best solution by Stack Overflow
- Where Do I Place Google Analytics Code Inside a .ASPX Page?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.