The Kingdom of Serbs, Croats and Slovenes (the official name) or Kingdom of Yugoslavia was created after WW1 by the victor states by joining parts of Austro-Hungarian Empire populated by ethnic Slavs with Kingdom of Serbia under the dynasty of Karađorđević. That way the Habsburg monarchy was dissolved and the Serbian Kingdom is rewarded for being allied to the victor states in WW1.
From the start of the new parlamentary monarchy state, situated on Balkan penninsula, there were tensions between its people because of the latent serbian hegemonistic ambitions within the joint kingdom that culminated in assasination of Croat leader Stjepan Radić in the middle of Parlament in Belgrade by a serbian unitarist and royalist.
What followed was even worse -
On 6 January 1929, using as a pretext the political crisis triggered by the shooting, King Alexander abolished the Constitution, prorogued the Parliament and introduced a personal dictatorship (known as the "January 6 Dictatorship", Šestosiječanjska diktatura, Šestojanuarska diktatura). He changed the name of the country to "Kingdom of Yugoslavia", and changed the internal divisions from the 33 oblasts (županije) to nine new banovinas on 3 October. A Court for the Protection of the State was soon established to act as the new regime's tool for putting down any dissent. (source http://en.wikipedia.org/wiki/Kingdom_of_Yugoslavia)
So you see, at the beginning of the WW2 the kingdom was already very much divided and polarised across ethic and religious differences of its peoples. The western parts of the kingdom were catholic (ethnic Croats and Slovenes) while the east (ethinic Serbs, Montenegrins and Macedonians) were orthodox with muslim majority in the middle (Ottoman turks and local Muslim in Bosnia). Add to that the economic tensions as well and you get the proverbial "The Balkan's barrel of gunpowder".
Germany and Italy tried to exploit Yugoslavia's domestic problems, [...]. In the end, the regency agreed to the formation of the Banovina hrvatska in August 1939. This did not put an end to the pressures from Germany and Italy, while Yugoslavia's strategic position deteriorated by the day. It was increasingly dependent on the German market (about 90% of its exports went to Germany), while in April 1939 Italy invaded and annexed Albania. In October 1940 it attacked Greece. by that time, France had already been eliminated from the scene, leaving Britain as Yugoslavia's only potential ally - given that Belgrade had not recognized the Soviet Union. London however wanted to involve Yugoslavia in the war, which it rejected. (source http://en.wikipedia.org/wiki/Kingdom_of_Yugoslavia)
The act of aggression by Axis force in April 1941 was the spark that ignited the whole country into the civil war and caused the definitive end of the kingdom.
From late 1940, Hitler wanted Belgrade to unequivocally choose sides. Pressure intensified, culminating in the signing of the Tripartite Pact on 25 March 1941. Two days later, Prince Paul was deposed in a coup d'état and his nephew Peter II was proclaimed of age, but the new government, headed by General Simović, assured Germany it would adhere to the Pact. Hitler nonetheless ordered the invasion of Yugoslavia. On 6 April 1941, Belgrade was bombed; on 10 April, the Independent State of Croatia was proclaimed; and on 17 April, the weak Yugoslav Army capitulated. (source http://en.wikipedia.org/wiki/Kingdom_of_Yugoslavia)
After the capitulation, the king went to exile, puppet governments were installed in Zagreb and Belgrade by the axis powers and parts of the country were annexed by Italy, Germany and Hungary.
In addition to WW2 destroying the continent and civil war raging in the country, shortly after the invasion started the communist revolution which additionally complicated already very complex theater.
I've written all this only to illustrate one major point: there was no single parameter, single allegiance or commitment to single goal for the military and political groups to adhere to. Because of that it is extremely hard to define the behaviour of any group according to only one parameter - helping the axis or the allies to win the war.
In general, we can try to conclude that the armed forces of the puppet states were loyal to the Axis, especially true for Independant state of Croatia and with Serbia under general Nedić. However if we inspect matters more closely, the situation is more complex.
In Croatia, regular army of conscripts was called Domobrani while the political extremists volunteered under the name of Ustaše. Within the Domobrani there were all kind of people with only one agenda - to survive the war. Ustashe had ideology and agenda to get rid of the Serbs and to create the first Croatian state after centuries of living under Austro-Hungary.
Ustashe were the most organized group and as such, and we know how Germans value organization, they were regarded a marginally better ally by the Germans. What would have happened to that alliance after the war we will never know for sure, but Ustashe were Croats and Croats were Slavs so we can now only speculate of how that fact would have reflected on mutual relations if the Axis had won the WW2.
The struggle between the Serbs and the Muslims/Ottomans lasted for centuries and during the Kingdom of Yugoslavia Serbs took partial revenge for the humiliation of having to live under Ottoman rule for five hundred years, so when WW2 started many muslims in Bosnia joined Croatian Ustashe to repay for recent atrocities.
In all of Yugoslavia, the communist party under Josip Broz tito organized local rebellions - the guerilla movement called Partisans with many communists who were experienced fighters from the Spanish civil war acting as officers. The agenda and the political marketing of the rebellion was primarily resistance to the occupation and the liberation of a country under the motto "Death to fascism, freedom to the people". In the background the foundation for the communist state after the war was laid firm. We can say about the partisans that they were allied to western forces as much as the Russians were - they had the common enemy.
Regarding the Serbia, general Nedić was installed as prime minister and was in control of the army but at the same time there are allegations that he secretly financed the royalist rebellion - the Chetniks.
The Chetniks are the most controversial group emerged in WW2 on former Kingdom of Yugoslavia soil and in general.
- They were rebels who fought the occupation on paper, but collaborated with Italians in Croatia and Germans in Serbia while at the same time saving american airforce pilots who fell on serbian territory.
- They were against the communist partisans but there are allegations and some evidence that many Chetniks converted to Partisans towards the end of the war.
- They were royalists but did not honored exiled government deal with Tito (before the battle at Neretva river they collaborated with the Partisans).
- They were created to protect the Serbs, but also collaborated with Ustashas and Italians who killed Serbs, and themselves killed many Serbs (entire Serb villages) who opposed them.
So to conclude, the alliance with either the Allies or the Axis was not top priority for any of the groups involved.