$.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();
    type: "POST",
    url: "includes/inc_rate.cfm",
    data: dataString,
    cache: false,
    success: function() {
    error: function (xhr, ajaxOptions, thrownError) {

Open in new window

Who is Participating?
reitersConnect With a Mentor Commented:
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');

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.
Michel PlungjanIT ExpertCommented:
How do you call it and what does your rendered HTML look like?
Michel PlungjanConnect With a Mentor IT ExpertCommented:
Just use

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

and it will not error (and it only errors in IE<9)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.