keyboard
04-02-2012, 04:52 AM
Hey everyone,
I've got this code
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
jQuery(function($){
var field1 = $('#fldrChatWindowInput'),
$('#send').click(function(){
if(!field1.html()){
alert("Please enter a value");
field1.focus();
return;
}
jQuery.ajax({
url: 'process.php',
type: 'post',
data: 'field1value=' + field1.html() + '&field2value=' + field2.value,
success: function(results){
alert(results);
}
});
});
});
</script>
<div id="fldrChatWindow"></div>
<div id="fldrChatWindowInput" contenteditable></div>
<input type="button" value="Submit" id="send">
Instead of alerting results, I'd like to assign it to a global variable that I'd use in normal javascript(not jQuery).
Sorry if the question is a little bit easy.
Keyboard1333
I've got this code
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
jQuery(function($){
var field1 = $('#fldrChatWindowInput'),
$('#send').click(function(){
if(!field1.html()){
alert("Please enter a value");
field1.focus();
return;
}
jQuery.ajax({
url: 'process.php',
type: 'post',
data: 'field1value=' + field1.html() + '&field2value=' + field2.value,
success: function(results){
alert(results);
}
});
});
});
</script>
<div id="fldrChatWindow"></div>
<div id="fldrChatWindowInput" contenteditable></div>
<input type="button" value="Submit" id="send">
Instead of alerting results, I'd like to assign it to a global variable that I'd use in normal javascript(not jQuery).
Sorry if the question is a little bit easy.
Keyboard1333