Why is my ajax live search not working when i use a shortcode to call it?

Your ShortCode callback method should take an atts parameter that stores the attributes passed to it from the do_shortcode call which is I am assuming how you are getting the $q parameter for the database query.

The callback method should also return instead of echo the output.

Without seeing any of the output/error messages I would say you’ll need to create a different method for the shortcode. Perhaps one that outputs the search form that will trigger the ajax calls.

Take a look a the Shorcode API for details on creating the callback.