I need to send a parameter from a link to another page that has a text field that calls a .php script and displays information related to the string entered. But if I reach this page passing the parameter by a URL instead of typing it in the text field of the page, the php returns only the json code to the screen. I need to bypass the text field from this url I am trying to build some how. I am trying to do this using ajax, but no success. Any suggestion?
JavaScript:
$(function(){
$("#textto").keyup(function(){
var txt = $("#go").attr( $(this).val() );
$.ajax({
url: './new_page.php',
data: {
'searching' : txt,
'pam' : 'name',
},
success: function(data) {
alert(data);
}
});
});
});
HTML:
<input type="text" value="" id="texto"/>
<a id='go' href="#">Another Page</a>