How to pass a variable from html to a document ready function

69 Views Asked by At

I need to pass a variable from my html code to the document ready function.

my HTML code has
<p>Welcome {{ajax_data}}</p>: ajax_data is being passed from my python code

Now what I need in my document ready function is the value of the ajax_data. For now I have hardcoded it

$(document).ready(function($)
{
    //ajax row data
    
    var data =
    [
        {"fname":"Code", "lname":"With Mark", "email":"[email protected]"},
        {"fname":"Mary", "lname":"Moe", "email":"[email protected]"},
        {"fname":"John", "lname":"Doe", "email":"[email protected]"},
        {"fname":"Julie", "lname":"Dooley", "email":"[email protected]"},
    ]

what i need is to pass the value of {{ajax_data}} inside the function to the variable data. Any help will be appreciated.

thanks jaideep

0

There are 0 best solutions below