Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-27-2013, 12:31 AM   PM User | #1
Vernk
Regular Coder

 
Join Date: Oct 2011
Posts: 113
Thanks: 9
Thanked 1 Time in 1 Post
Vernk is an unknown quantity at this point
JQuery stops working after more then 1 action HELP!

PHP Code:
$(document).ready(function() {
    $(
"#createorder").click(function() {
    $(
"#message2").html("<div class='alert info no-margin top'>Validating order...</div>");
        var 
action "check.php";
        var 
form_data = {
            
delay: $("#delay").val(),
            
votes: $("#votes").val(),
            
threads: $("#threads").val(),
            
sid: $("#sid").val(),
            
order1
        
};
        
        $.
ajax({
            
type"POST",
            
urlaction,
            
dataform_data,
            
success: function(response)
            {
            
                if (
response == '1')
                        $(
"#message2").html("<div class='alert success no-margin top'>Order has been successfully created!</div>");
                        $(
"#voteform").slideUp();
                        
                        
                    else if (
response == '2')
                        $(
"#message2").html("<div class='alert error no-margin top'>You do not have enough credits to order.</div>");
                    else if (
response == '3')
                        $(
"#message2").html("<div class='alert error no-margin top'>Your thread count has exceeded the limit.</div>");
                    else if (
response == '4')
                        $(
"#message2").html("<div class='alert error no-margin top'>Your vote count has exceeded the limit.</div>");
                    else if (
response == '5')
                        $(
"#message2").html("<div class='alert error no-margin top'>Your delay count has exceeded the limit.</div>");    
                    else if (
response == NULL)
                        $(
"#message2").html("<div class='alert error no-margin top'>Something went terribly wrong , please contact support!</div>");
                
                
            } 
        });
        
        return 
false;
    });
                
    }); 
Hello,

See where it says
$("voteform").slideUp;

That is causing the jQuery to stop working,
it's not just that if I put more then 1 line after success it stops working
I tried to alert them after the notification and it doesn't work , but if it's just the notification box it will work...

Last edited by Vernk; 01-27-2013 at 01:29 AM..
Vernk is offline   Reply With Quote
Old 01-27-2013, 12:47 AM   PM User | #2
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
try using proper syntax for the if else's

Code:
if (1==1){
//do something
}
else if (1==2) {
//do something else
}
else if (1==3) {
//do something
}
else {
d/do soemthign if no other value is met
}
alos you should change the first line from

Code:
  $("#createorder").click(function() {
to this

Code:
  $("#createorder").click(function(e) { 
e.preventDefault();
and remove the return false
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users

Last edited by DanInMa; 01-27-2013 at 12:53 AM..
DanInMa is offline   Reply With Quote
Old 01-27-2013, 01:28 AM   PM User | #3
Vernk
Regular Coder

 
Join Date: Oct 2011
Posts: 113
Thanks: 9
Thanked 1 Time in 1 Post
Vernk is an unknown quantity at this point
Hello,

Thanks for the help.
It looked like the if else were the problem
It is working now

Thanks!
Vernk is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:49 PM.


Advertisement
Log in to turn off these ads.