Its first time am using jQuery $.get(). Also am new to jQuery. My code is very simple. I just want something to be returned by a .php file. The code is as fol
<html>
<head>
<meta charset=\"UTF-8\">
<script src=\"jquery.js\" type=\"text/javascript\"></script>
<style>
</style>
<script type=\"text/javascript\">
$(\'document\').ready(function() {
$(\'#mybutton\').click(function() {
var str = $(\'#mytext\').val();
console.log(str);
$.get(\'abc.php\', {
input: str
}, function(da) {
$(\'#mydiv\').text(da.toString());
$(\'#mytext\').attr(\'value\', da);
console.log(da.toString());
console.dirxml(da);
});
});
});
</script>
</head>
<body>
<input id=\"mytext\" type=\"text\" /><br/>
<input id=\"mybutton\" type=\"button\" value=\"Ajax Get\"/>
<div id=\"mydiv\">...</div>
</body>
The php file is a simple echo…I have tried many things but nothing work.The problem is that .get does not return anything in the URL ie the url remains the same..As you can see I have also tried to parse the XML file in Fire Bug but I think that is also empty.Plz some help.. thankss..
WHAT I HAVE TRIED
I have tried to change $.get to jQuery.get
I have tried $.post instead of $.get
There is no 301 re-direct since I have copied my file to a new folder and tried to run this 1 file simply.
Am not using codeigniter.. in fact i was but moved this file to seperate directory.
tired to convert the return input into string (as you can see in code)
Also I read all questions on stackoverflow…
copied and tried the example codes from W3C websites and others…





Rating:
The post jQuery $.get return [Object XML Document] and nothing else appeared first on Javascript ASK.
via Javascript ASK http://javascriptask.phpfogapp.com/jquery-get-return-object-xml-document-and-nothing-else.html
No comments:
Post a Comment