Applying for visa in a country which is not your home country or the U.S., called a “third” country, can be more difficult than applying at home. You may need to prove that you have continuously maintained lawful non-immigrant status during your time in the U.S. or you may be sent to your home country to apply for the visa.
Refusal in a third country is more likely than at home, so you should plan well in advance of your date of travel. This page will explain what steps you should take to get a visa in a third country.