Can an Ajax script access different website's webpage? for example i tried following
What is wrong with this code?
No, it cannot, due to the Same Origin Policy: http://en.wikipedia.org/wiki/Same_origin_policy
Your request is valid if the endurl (in your case.. google.com) supports returning data in jsonp format.
No, you cannot access webpages of other domains and hosts, even i tried the same thing you tried, due to security reasons browsers do not allow so.