What is the difference between 挣扎 and 奋斗? When I search both online I get the same definition of 
to struggle.

What is the different use of them then if the meaning is the same?
奋斗：to make a great effort to achieve something, usually striving to be successful. It's a positive word, because you have a target to achieve.

挣扎：try to struggle (to get free), usually we say someone is trapped by something bad, and try to struggle from it. It's much more passive feeling, because you have to struggle in order to escape from something bad to you.

See these expressions:

我们要迎难而上，努力奋斗，争取获得技术突破。

你们已经被包围了，赶快投降，不要做无谓的挣扎。