Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

A AJAX behaving misterious here

Explorer ,
Dec 15, 2008 Dec 15, 2008
I have some AJAx cod which behave very awkward..

I have some submit code which i submit the value to a page.

Here is what i do:

i have a form and input type text named as firstname..

then i have button as:

<input type="button" name="abc" onClick="doForm()">

Here is my Script Code:

doForm = function()
{
ColdFusion.Ajax.submitForm('formName', page.cfm', myCB3, myError3);
}
myCB3 = function(resp){
var msgDiv = document.getElementById('message');
msgDiv.innerHTML = resp;
}

myError3 = function(sc,msg){
alert('Error!!! ' +sc +' '+msg);
}

Then i use <div> tag to display the error or success message as:

<div id="message"></div>

on my Page.cfm i have something like this:

<cfif form.firstname IS 0>
Err! Please enter first name
<cfelse>
query stuff
Done!!! entereted successfully
</cfif>

What it do is it loads something the message in the div and sometime it don't.

I have firebug enabled and when it does not show me that it has executed..

i open firebug and see its response. i see the message there.

is something wrong i am doing..

Please show me a way guys.
TOPICS
Advanced techniques
525
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 16, 2008 Dec 16, 2008
Try doing an alert() within myCB3 to verfy your response?

myCB3 = function(resp){
alert(resp);
//var msgDiv = document.getElementById('message');
//msgDiv.innerHTML = resp;
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 16, 2008 Dec 16, 2008
if i use alert(resp); it works everytime but a huge alert box appears.

and if we use alert how we remove that freaking whitespace.

Cheers
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 22, 2008 Dec 22, 2008
LATEST
Try giving a <cfsetting enablecfoutputonly="true"> in the cfm page and try.
Make sure you giv <cfoutput> tags around the messages.

--
Prasanth Kumar.S
"newchickinCF" <webforumsuser@macromedia.com> wrote in message
news:gi8n91$jkj$1@forums.macromedia.com...
> if i use alert(resp); it works everytime but a huge alert box appears.
>
> and if we use alert how we remove that freaking whitespace.
>
> Cheers


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources