×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Reload div after form submission success

Reload div after form submission success

Reload div after form submission success

(OP)
I have a classic asp site that is being partially updated to html5 and responsive design. There is a poll in an iframe that I am trying to move to a div. To do this I used

CODE -->

$.get('Poll/poll.asp', function(data) {
  $('#poll').html(data);
}); 

This loads the page/content into the div without issue. On the poll itself, I changed the action and method to onsubmit="return subpoll" .
I am serializing the form data successfully and submitting the form:

CODE -->

$(function subpoll() {
    //hang on event of form with id=formPoll
      $(document).on('submit', '#formPoll', function(e) {
        //prevent Default functionality
        e.preventDefault();

        //do your own request an handle the results
        $.ajax({
                url: 'Poll/poll.asp',
                type: 'post',
                dataType: 'json',
                data: $("#formPoll").serialize(),
                        
success: function(data){
   if(data.success == true){ // if true (1)
      $("#poll").load(" #poll > *");
}
}
});

    });
}); 
After I submit the form I have to refresh the page manually to see the results. I have tried many things in the data.success function without any luck. I need to reload the div with the poll results after successful submission. I am a novice with jquery/ajax/json so I may be missing something simple but I am beyond my abilities here. Poll/poll.asp submits to itself and shows the results as well. Any help would be appreciated. Thanks.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close