考虑以下代码
<a
href={someURL}
onClick={() => {
onEnterSurvey(args);
}}
>
假设程序员不会调用event.preventDefault()
之类的功能(她/他没有在代码中进行编程)。
然后可以发出POST请求吗?
在POST请求发生之前,将发送OPTIONS请求。
答案 0 :(得分:-1)
在Firefox中,这似乎不起作用。在Google Chrome中确实如此。但是,当我将代码更改为:
# User input here
# if else statements here
recentLoc = input("What is your location right now?")
temp = float(input("What is the temperature outdoor tomorrow?"))
def convert_f(temp): # The function modified
f = (temp*9/5)+32
return(str(f))
def convert_c(temp): # The function modified
c = (temp-32)*5/9
return(str(c))
if recentLoc == ger and location == us:
print("Temperature for tomorrow is " + convert_c(temp) + "Celsius or " + convert_f(temp) + "Fahrenheit")
elif recentLoc == us and location == ger:
print("Temperature for tomorrow is " + convert_f(temp) + "Fahrenheit or " + convert_c(temp) + "Celsius")
elif recentLoc == us and location == us:
print("Temperature for tomorrow is " + convert_f(temp) + "Fahrenheit")
elif recentLoc == ger and location == ger:
print("Temperature for tomorrow is " + convert_c(temp) + "Celsius")
else:
print("Please type in a number")
在两种浏览器中都可以使用。