Search code examples
phpjavascriptjquerymysqlpopulate

Add Mysql Data into js var in external javascript file


I got problem with my script.I want to populate a textarea which is generated over a javascript file.The Textarea is filled with the Value.Now i want to insert into this value a mysql statement

file.js





        run: function()
        {
            var html = this.boxHTML.val('mysql statment');
            var css = this.boxCSS.val('');
            var js = this.boxJS.val('');
            var jQuery = '';
            var jQueryUI = '';
            var jQueryUITheme = ''

            var result = '' + jQuery + jQueryUITheme + jQueryUI + '' + css + '' + html + '' + js + '';

            this.writeResult(result);
        },

This is my file where the Output is generated including external js file an jquery.

file.php

       

    

        var jsn = null;
        $(document).ready(function()
        {
            $('#JSNova').height($(window).height());
            jsn = $("#JSNova").wJSNova();
            jsn.wJSNova('resize');
        });

        $(window).resize(function()
        {
            $('#JSNova').height($(window).height());
            jsn.wJSNova('resize');
        });



I cant getr it to work populate the textarea with the values from the Mysql Statement.


Solution

  • as jquery is client side script, it will not execute mysql query directly, try using jquery AJAX

    refer url: http://api.jquery.com/jQuery.ajax/