Q:

Difficulty enqueuing script in wordpress plugin

I'm trying to build a WordPress plugin that will fetch data associated with the post from a table on mouseover event and append it to another div. I managed to write a little code with zero to no understanding of js and PHP. 
I installed and activate the plugin but the js is not being loaded on the page. Am I not enqueuing my script correctly? I also want to achieve the following: The script should only be loaded on a desktop, so not for mobile devices.  
Any help or pointers in the right direction would be great!
My php code
<?php

/* PLUGIN INFO */

function sknv_ea_return(){

$ea_id = isset( $_POST['post_id'] ) ? $_POST['post_id'] : 0;

if ( $ea_id > 0)
{
    $ea_post = get_post($ea_id);
    ?>
    <div id="ea_post"><?php echo $ea_post->post_content; ?></div>
<?php
}
die();
}
add_action('wp_ajax_nopriv_sknv_ea','sknv_ea_return');

function sknv_ea_get_scripts()
{
wp_enqueue_script( plugins_url( 'sknv_ea.js', __FILE__ ));
}
add_action('wp_enqueue_scripts', 'sknv_ea_get_scripts');

?>

and my JS code
 jQuery(document).ready(function ($)  {
$("tr.emcustom").onmouseover( function() {
var div = $(this);

$.post('wp-admin/amdin-ajax.php' , {
    action: "sknv_ea",
    event_id: $(this).find("a").attr("id")
}, function (data) {
    $("#agenda_title").append($(data));
}
      );
return false;
});

$("tr.emcustom").mouseout( function() {
    $("ea_post").remove();
});
});

A:

Enqueueing your script
The problem is that you are not using wp_enqueue_script correctly, but there are also a couple of other things to check as well:

The first parameter into wp_enqueue_script is a handle for your script, the soruce file is actually the 2nd parameter
Your js file requires jQuery so you should specify that as a dependency to make sure it gets loaded after jQuery
Make sure your .js file is in your plugin root folder, and not in a subfolder

Update your sknv_ea_get_scripts function as follows:
function sknv_ea_get_scripts(){
    wp_enqueue_script( "sknv_ea", plugins_url( 'sknv_ea.js', __FILE__ ), array( 'jquery' ));
}

Note:

"sknv_ea" is the handle for your script  - you can call this whatever you want as long as its unique so as not to clash with any other handle
The 3rd parameter array( 'jquery' ) is an array with the handles for all scripts that your script depends on and that must be loaded before yours. In this case I've just included jQuery, but if you have any other dependencies you should include them in the array. Also note, the default handle for jQuery is jquery but if you are loading your own version make sure to change the handle accordingly.

Loading only on Desktop
Wordpress provide a function wp_is_mobile() (Codex Reference) that detects if the visitor is on a mobile device, so you could wrap your call to wp_enqueue_script with it, e.g. 
function sknv_ea_get_scripts(){
    if (!wp_is_mobile())
        wp_enqueue_script( "sknv_ea", plugins_url( 'sknv_ea.js', __FILE__ ), array( 'jquery' ));
}

But note that it may not be very reliable, as it works by checking the browser user agent string. Another potential issue is that it considers tablets as mobile devices. There are also plugins available such as mobble, but I've never used any so I can't recommend any.

