views:

38

answers:

1

Hi all,

I need to create a desktop widget where the users wants to update their details from the desktop html file.i haved tried with ajax but the value getting stored in the database but the response cannot get back to html file,i have included the remote js file into the html file. Im using Windows OS, php 5, Xampp server.

the sample script is follows,

    <script type="text/javascript" src="http://bizzedge.freezyads.com/scripts/widget.js" 

></script>

<input type="text" value="75" style="border:0; width:20px;" maxlength="2" 

onblur="myscore(this.value,'51')" 
/>
A: 

It would appear you're using using GET query parameters, but sending the AJAX request via POST.

var url='http://bizzedge.freezyads.com/ajax/widget.php?id='+id+'&amp;usr='+user;
...
xmlhttp.open("POST",url,true);
xmlhttp.send();

Not that it seems to matter, as the script gives me output when I hit the URL directly in Firefox (broken image, mangled layout, but at least it's a response). A proper POST AJAX request done this way would pass the paramters in the .send() call:

xmlhttp.send('id=' + id + '&usr=' + user);

I would suggest using jQuery or MooTools to handle the AJAX side of things. They provide far more debugging capabilities in case something blows up, rather than trying to roll your own handlers. As well, use something like HTTPFox, which will let you monitor HTTP requests as they come/go from the browser. With this you can see the response in its raw state (and its headers) as it comes back before any processing.

Marc B
jQuery did the trick for me. thx Marc!
paulrajj