开发者

jQuery how to pass in more than 1 parameters in the load method

开发者 https://www.devze.com 2023-02-28 04:07 出处:网络
I have a load method loading some data. But its not liking how i am loading more than 1 paramete开发者_如何学编程r. Is there a way to load more than 1 parameter. Also I want to be able to get the sele

I have a load method loading some data. But its not liking how i am loading more than 1 paramete开发者_如何学编程r. Is there a way to load more than 1 parameter. Also I want to be able to get the selected index and place it where the 0 is with jquery(this).attr("selectedIndex")) is that possible. Here is my code.

   jQuery('#EntryForm').load('../IRElectricalBaselineEntryPage.aspx #contentBlockElectrical',
                { trainid: <%=Inspections[0].ID%> , inspectid: <%=Equipment.ID%> });

where that Inspections[0] I want to place jquery(this).attr("selectedIndex"))

Thanks!


{ trainid: <%=Inspections[0].ID%> , inspectid: <%=Equipment.ID%> }

This should work fine, but you may need to but the values in quotes.

{ trainid: '<%=Inspections[0].ID%>' , inspectid: '<%=Equipment.ID%>' }

If you want to use jQuery(this).attr("selectedIndex"), to get a value from Inspections, you'll need to save <%=Inspections%> to a JavaScript array first, then get the element you want. I don't know ASP, so I'm not sure how to do that.


You have two options... 1. You can use the querystring like this...

$("#myDiv").load("PageName.aspx?myVarA=" + myVarAVal + "&myVarB=" + myVarBVal);
  1. Or you can pass in arrays of data - remember that this command is truly just shorthand for $.ajax ...

$("#myDiv").load("PageName.aspx", {myVarA : myVarAVal});


../IRElectricalBaselineEntryPage.aspx #contentBlockElectrical

Take the anchor ("#contentBlockElectrical") off and that should work. Looks like you're confusing it about the URL where you want it to post the information.

0

精彩评论

暂无评论...
验证码 换一张
取 消