[Solved] how to use ajax in plugin admin area?

sun Asks: how to use ajax in plugin admin area?
I tried ajax to get some info a php inside my plugin.but getting error-call to undefined function. Ajax

Code:
jQuery.ajax({
        type: "POST",
        url: "<?php echo plugins_url();?>/tester/inc/test.php",
        data: { param: 'st1' }
      }).done(function( msg ) {
             alert( "Data Saved: " + msg );
     });

Error in alert

Code:
Data Saved: <br />
<font size='1'><table class='xdebug-error xe-fatal-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Fatal error: Call to undefined function add_action() in E:wamp1wampwwwwp_twentythirteenwp-contentpluginstesterinctest.php on line <i>7</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0007</td><td bgcolor='#eeeeec' align='right'>254944</td><td bgcolor='#eeeeec'>{main}(  )</td><td title='E:wamp1wampwwwwp_twentythirteenwp-contentpluginstesterinctest.php' bgcolor='#eeeeec'>..test.php<b>:</b>0</td></tr>
</table></font>

test.php

Code:
<?php
function aj()
{
 echo "hello";
echo plugins_url();
}
add_action('wp_ajax_my_action','aj'); 
add_action('wp_ajax_nopriv_myFunction','aj'); 

 ?>

i think the error denote like am not inside wordpress. Any idea?

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.