Can't get search bar results inside JSONP call

I have recently written a short script to accept input from a search bar for the wikipedia search project, and I also found an example of a JSONP call to the api that works for this project. The only problem is that I cannot seem to put the input-accepting script inside the JSONP request so that the JSONP script can see the variable that I made to capture the user input. My plan is to add this variable into the JSONP call, but it currently is not working. What should I do? I have tried accessing the variable from the JSONP with the input-accepting script both inside and out, and neither works. Here are the two pieces of code that I am talking about:

This is the user search part:

$(document).ready(function(){

$(’#initSearch’).click(function() {
var usr_search= $(’#userText’).val();

//console.log(usr_search); // used this to make sure the script worked like I thought

});

});

This is the JSONP part:

$.ajax({

url: 'https://en.wikipedia.org/w/api.php?',
type: 'GET',
dataType: 'jsonp',
data: {
 action: 'opensearch',
 format: 'json',
 search: 'soccer',
},
success: function (data) {
 $('p').append(data[3]);
}

});

Here is a link to the part of the html that I am working with if that helps:
http://pastebin.com/3G0h5jvk
Thanks!

This is my v:
$.ajax({

			dataType: 'jsonp',
			jsonp: 'callback',
      url: "https://en.wikipedia.org/w/api.php?action=query&format=json&list=search&srsearch="+searchText,
      success: function(json) {

So try to add to ur v, property jsonp, and
U might change action in your data prop to query…