Why is an integer variable in PHP interpreted as a string literal when passed from Drupal to JavaScript via Drupal.settings? This is in Drupal 7.

I'm attaching some JavaScript via drupal_attach_js(), using "settings` to be able to pass the "height" parameter to a JavaScript function. The height is used in a modal dialog, and it will vary depending on the amount of data that the modal will contain.

Here is my JavaScript code:

(function ($) {

  Drupal.behaviors.designer = {
    attach: function (context, settings) {
      // ...some code to activate modal...
      height: settings.designer.jquery_modal_height,
      // ...some more code...
    }
  };

})(jQuery);


If I run console.log(settings.designer.jquery_modal_height), then the console displays the value of this variable, but the actual "height" parameter seems to take the code literally and never applies it's actual value.

Am I doing something wrong?
If you do

{
  ..
  height: settings.designer.jquery_modal_height,
  ..
}


You are doing it right, else you should do

..
var height = settings.designer.jquery_modal_height;
..


Most likely it's not the variable that's the problem but some other part of your code.