Cannot use elgg library functions, for the php file used in url argument of elgg.get function

I am trying to use elgg.get ajax functionality to get some data from a php file. 

elgg.get('<?php echo elgg_get_site_url(); ?>mod/plugin_name/load_data.php?q=' + text,{

                success: function(data){
                    $("#span_id").html(data);
                }
            });

In the load_data.php file, whenever I use any elgg function (eg: current_page_url()) it says in the error log that it is undefined. Moreover, I had created a function in plugin library (which i registered and loaded in start.php) but when i use that function in load_data.php and call it using ajax, it still says that its undefined, anybody knows how do i resolve this situation? Note : I also used the regular jquery ajax functions, but as expected, got same problem.