Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Need some help with .ajax/jquery loading content after $.ajax post request.

Posted on 2011-03-06
2
Medium Priority
?
304 Views
Last Modified: 2012-05-11
Hello, I'm getting comments to load into the db just fine with the POST $.ajax request but during the success part I'm trying to load the id results with the index.cfm page. Doesn't seem to be working with what I have so far.

Thanks,

Brian
$("form#frmComment").submit(function(){

	var datastring= $('form#frmComment').serialize();
	$.ajax({
		type: "POST",
		url: "inc_comments.cfm",
		cache: false,
		data: datastring,
		success: function(){
			$("#results").get("index.cfm");
		}
	});// .ajax()
  }); // .submit()

Open in new window

0
Comment
Question by:brihol44
2 Comments
 
LVL 6

Accepted Solution

by:
GregArnott earned 2000 total points
ID: 35049912
As you've made the submit, success and response in one, I believe you need to sync the return data for it to work.

ie:
$("form#frmComment").submit(function(){

	var datastring= $('form#frmComment').serialize();
	$.ajax({
		type: "POST",
		url: "inc_comments.cfm",
		cache: false,
		data: datastring,
		[b]async:false,[/b]
		success: function(){
			$("#results").get("index.cfm");
		}
	});// .ajax()
  }); // .submit()

Open in new window


Alternatively, set the process into the trilogy of $.ajaxSetup(), $.ajax() and $.ajaxSuccess()
0
 

Author Closing Comment

by:brihol44
ID: 35098040
Awesome! It worked!

Thanks,

Brian
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question