How do we apply Ampère's law for non-planar loops? How do we apply Ampère's (magnetism) law for non-planar loops?
Its most general form(or you can say the only one I know) is
$$
\oint_C \mathbf B\cdot\mathrm d\mathbf l = \mu_0 \iint_S\mathbf J\cdot \mathrm d\mathbf S
$$
But what would current enclosed mean in case of non planar loops. I mean infinite amount of curves can contain such loop. As a result while the right-hand side (line integral of B field) would same in each but the integral of current density would be different for each curve (surface or manifold).  
 A: This is relatively standard materials, so for the details you can consult your favourite EM textbook, but I'll sketch the overview.
The problem with Ampère's law, for any kind of loop (including planar loops!) is that there are plenty of surfaces $S$ that share the same boundary $C=\partial S$, which makes the statement
$$
\oint_C \mathbf B\cdot\mathrm d\mathbf l = \mu_0 \iint_S\mathbf J\cdot \mathrm d\mathbf S
$$
a bit suspect, unless we can (a) choose a canonical surface $S$ for each curve $C$, or (b) show that the surface integral on the right-hand side is actually independent of what surface we choose.
The resolution to this is, in fact, (b): the current flow really is independent of the surface you choose. To prove this, consider two surfaces $S_1$ and $S_2$ which share the same boundary $C$, so that we want to prove that
$$
\iint_{S_1}\mathbf J\cdot \mathrm d\mathbf S
=
\iint_{S_2}\mathbf J\cdot \mathrm d\mathbf S,
$$
or, equivalently, that
$$
{\large\bigcirc}\kern-1.55em\iint_{S}\mathbf J\cdot \mathrm d\mathbf S
=
\iint_{S_1}\mathbf J\cdot \mathrm d\mathbf S
-
\iint_{S_2}\mathbf J\cdot \mathrm d\mathbf S
=0,
$$
where $S$ is the closed surface that surrounds the space between $S_1$ and $S_2$.
Now, there's a bunch of ways to prove that that integral is indeed zero, but they all boil down to this: the closed surface integral $\mathop{\vcenter{ \unicode{x222F}}}_{S}\mathbf J\cdot \mathrm d\mathbf S$ represents the net amount of charge that enters the volume between $S_1$ and $S_2$ per unit time, and for a static situation, that net amount needs to be exactly zero, or you would have a linear growth of the enclosed charge in that volume, quickly taking you out of the static situation you thought you were in.
Of course, this does mean that Ampère's law as formulated here can no longer hold without modifications in dynamic situations - and, indeed, in that case you need to extend it to the Ampère-Maxwell law, which includes an additional term in the surface integral, and which again has the property that it holds regardless of what surface $S$ you choose to integrate over.
