$.ajax + Coldfusion form is always selecting first value in select field.

Hello, I'm using the alert function and I see that I'm getting input values but all of the select values are only selecting the very first <option> value even if I select a different value.

function rate_it() {
  
  dataString = $("#myForm").serialize();
  alert(dataString);
  
  $.ajax({
    type: "POST",
    url: "includes/inc_rate.cfm",
    data: dataString,
    cache: false,
    success: function() {
      
    },
    error: function (xhr, ajaxOptions, thrownError) {
      alert(xhr.status);
      alert(thrownError);
    }
  })  
};

Open in new window

brihol44Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
How do you call it and what does your rendered HTML look like?
0
reitersCommented:
For debugging ajax you should use the firebug addon for Firefox.  It's awesome.  You can push debug info to the console without using alerts (alerts are a pain).

<script type="text/javascript">
console.log('hello world');
</script>

Console.log and also display complex data types without serializing (unless you want to).

Just know that if you use console.log without the console open JS will error so make sure you remove them when no longer testing.

Firebug will also let you see exactly what is being posted etc.  Invaluable tool.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Michel PlungjanIT ExpertCommented:
Just use

window.console && console.log('hello world');

and it will not error (and it only errors in IE<9)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.