Jump to content

AJAX issue with selective reloading


lastlifelost

Recommended Posts

I'm using the following code to reset a contact form. It's working fine to remove the entered data, but it's not resetting the HTML the way I think it should

function selectiveReload(section, url) {	//contrstucts the jQuery-compliant id	sectionId = "#" + section;		//OPTIONAL: determines the page to grab new content from.  	//If left blank, will load content from the current page	url = (url === undefined) ? document.location : url;		//determines the original element's tag name for use with inserting the new content	tag = ($(sectionId).get(0).tagName);	tag = '<'+tag+'><\/'+tag+'>';		//loads and inserts the new content	content = $(sectionId).load(url + ' ' + sectionId).html();	content = $(tag).attr("id",section).html(content);	$(sectionId).replaceWith(content);}

What's happening is when a bad email address or blank line is found, another script will flag it, show an error message and add some styling. The reset script above should be grabbing the whole form fresh from the server and replacing that content block in the HTML, thus removing the styling and the data entered (if any). An example can be seen here: http://stweb.ccv.edu/CIS-2140-VO01-V11SP/s...ments/9test.php. Am I missing something important or am I asking for something that can't be done in this way?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...