Solved

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

Posted on 2011-03-06
2
284 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
GregArnott earned 500 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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

740 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