Can I get a virus on my iPhone? Or can my iPhone get hacked?

I haven't jailbroken(IOS9), but I got a warning sign that I got a virus as I entered a website in safari. So I cleared safari history and website data immediately. What should I do?

It can never happen in ios devices, unless you have jailbroken the device.
i must be a prank or a spam, don't worry about it.

That is a lie they always say stuff like "WARNING YOUR SYSTEM HAS A VIRUS" etc

That was likely a hoax message. Wouldn't have been able to jailbreak anyway since there's none for iOS 9 at this point.