Error opening Partial’s in a new tab from a function in javascript

Asked

Viewed 88 times

1

I have the following case: I have a navigation page of "Third Party", with several Partials defining their corresponding data.

To do that navigation I’m doing by javascript, and carry the Partial as follows (example of a partial):

$("#divContactosTerceiro").empty();
$("#divContactosTerceiro").load("Terceiros/sContactosTerceiro", { NumRegistoTerceiro: result.result.NumRegisto });

Here send the data NumRegistoTerceiro to the controller Terceiros/sContactosTerceiro. So far so good, works perfectly.

What I’m doing now? I’m opening a new tab from a Alertas, the page of Terceiros, where will perform the function javascript of the above code example.

Problem? Is that the javascript adds twice the name of the controller to load Partial in the new tab, as shown in the image: inserir a descrição da imagem aqui

How can I get around this problem? I can’t find any useful reference on the net.

  • It doesn’t work if you use .load("~/Terceiros/sContactosTerceiro"?

  • It doesn’t work if you use .load("Terceiros/sContactosTerceiro"

1 answer

1


Put it like this:

$("#divContactosTerceiro").load("/Terceiros/sContactosTerceiro") 

Problem: The bar before Third Party is missing so the duplication

  • Thanks, I’ve been two hours on this because of a / :P

  • is the MVC changes some concepts and the / makes a difference, how nice to help

Browser other questions tagged

You are not signed in. Login or sign up in order to post.