Hi, I also having the same problem for the last few months, but i finally found a solution for it. first i'll tell what is the problem & how it happen to you galaxy phone.
whenever happen to this wifi issue is when u have updated the firmware of the phone original version 4.1.1 to 4.1.2 jelly...