Yes a visa can be obtained in the United States if certain requirements are met previous to the filing of the petition.
There are two ways to obtain a visa to enter the United States on a temporary or permanent basis.
Under the consular visa process, a foreigner request permission to enter the United States at the American Embassy or Consulate in his/her country of nationality. The person will then be issued a visa that can be a temporary or permanent visa.
Once the person enter the United States at the port of entry, he or she is inspected and admitted by an immigration officer at the port of entry, normally the jurisdiction of the CBP ( Customs and Border Patrol).
A Person then, is issued an authorization to stay that is stamped at his passport that is the authorized period of stay, that depends on the type of visa issued by the American Embassy, American Consulate abroad.
Tourists or visitors for pleasure and or business (B1/B2) are authorized for a maximum period of 6 months, at that time they must depart the United States of America or before the expiration of the authorized period of stay they must file for an extension or change of status to another immigrant or nonimmigrant visa category.
A person can either request for an extension to stay under the current non-immigrant visa, or request for a change of status (new different type or class of visa).